[ardoJSON] Trouble Converting json 2 structure

[ardoJSON] Trouble Converting json 2 structure

Forge Component
Published on 2 May by Ricardo Silva
22 votes
Published on 2 May by Ricardo Silva

Hello All,

First of all I must say I'm pretty new to outsystems it self and even more to ardoJson.

I have a json object that I want to convert to a Structure.

This json was created using ardoJson api, I've grabbed the values from the structure and converted it to a json object, after that I've stored the value into an entity field.

Now when I try to convert the json object back to the structure I get an exception.

What I'm doing:

I query the entity and grab the field that contains the json object(text), after that I parse that field to the action "Json2RecordField" json parameter and on record list parameter I insert toObject(Structure).

Any ideas on how to convert my json object back to the original structure.


You need to pass a List to the ToObject() function, not a structure.


thank you :D

You're welcome :). The technical reason behind this, is that there's no way to convert an Object back to anything else. So if you pass a Record or Structure instead of a List, the extension can handle it fine, but it can't pass the result back to you in a meaningful way (only as Object*). A List on the other hand is passed by reference, so that if the extension changes the list that you pass as input, it "stays" changed once the extension is done with it. So even if you expect just a single record back, you need to pass it via a list.

*For generic records/structures. If the record/structure is defined in the extension itself, it is of course able to output a variable of that type.