I want to use the forge asset "Data Conversion [for XML, JSON etc]"
I'm using XMLToJSON to convert a XML to JSON.
But I can't figure out what to fill in for the field "Attribute List for Record To Array List:"
Suppose I have the attached file.
Now I want Brand and Type to be lists. How can I achieve this? What do I have to fill in the field "Attribute List for Record To Array List:" ?
If I fill in only "Brand" it works. But I can't figure out what to fill in for several attributes that should be lists.
In my experience, one practical approach to get JSON from an XML payload in OutSystems is to use a Forge component (extension) that converts XML text directly into JSON text. This is especially useful when the XML structure changes frequently and you don’t want to maintain a full set of Structures + XMLToRecord mappings.
Below I’m sharing a working example I implemented, so you can see exactly how it’s done.
Example:If this helps, please don’t forget to mark the answer as the solution, so other people with the same issue can find it more easily in the future.
If you just need convert exactly the input XML to output JSON, just leave that blank
On the other hand, it is to specify which attribute names to convert as an array. The delimiter of that text is $
hello ,This field accepts a comma-separated list of XML node names that should always be converted into JSON arrays. So if you want both Brand and Type to be treated as lists, just enter: Brand,Type What this does in OutSystems Data Conversion (XMLToJSON) is force those attributes to be output as arrays even when there’s only a single occurrence in the XML. Example: Brand → [ ... ] Type → [ ... ] You don’t need XPath, JSON syntax, or quotes—just the attribute names separated by commas. If only Brand works now, it’s because the component already supports multiple attributes; they just need to be listed together in this format.
Hi @Piet Zwart
In the XMLToJSON action from the Data Conversion Forge asset, the field “Attribute List for Record To Array List” is used to specify which XML elements should be converted into JSON arrays. If multiple XML tags repeat, such as Brand and Type, their names should be provided as a comma-separated list (for example: Brand,Type). The names must exactly match the XML tag names and are case-sensitive. This ensures that those elements are converted into JSON lists instead of single values.