I have a JSON string (returned from api) having the following structure
```{ "data": [ [ [ "Answer the question", "_(Referencing page 1, page 1-2)_\n\nThe provided text..." ], [ "Answer the question again", "_(Referencing page 2)_\n\nThe provided text..." ] ], { "headers": ["Page", "Content"], "data": [ ["1", " the eighth day"], ["1-2", " over 3000 centres"] ], "metadata": null }, null ], "is_generating": false, "duration": 0.003, "average_duration": 0.06, "render_config": null, "changed_state_ids": []}```
I copied the JSON, and selected ADD structure from JSON. The problem is that the deserialized structure is empty.
I don't know if the structure is set incorrectly, or that OutSystems does not support parsing the JSON format I provided. Can anyone provide solution in parsing the json, so that I can retrieve the content?
I am actually mostly interested in the second string in the last record in the nested list (i.e. the red colored text).
In python, I can do json.loads(), and get the data list, and select [0][-1][-1]. I don't know how I can achieve that in OutSystems. Can anyone help me through?
Hi @Rochefort McGill ,
I have added oml with your JSON structure.
hope this will help you.
Hi @Rahul Sahu
It does not resolve the issue. As you can see in the pictures, the expanded structure has the data-items' content all empty.
For instance, the text "_(Referencing page 2)_\n\nThe provided text..." in my original JSON text is not found in the structure.
Is there any way to fix that? Or OutSystems just cannot parse the 3D list?
I see 2 problems in your JSON:
You'll need to change your JSON format to be able to use JSONDeserialize. If your only option is to manipulate the JSON in OS, then you can refer to this post, where someone has a similar problem. The suggestion is to use the JSONata forge component (I haven't used this before, so I don't know how it works but it seems quite powerful).
Yes, Francisca is correct, I also faced similar kind issue while receiving the polygon data. OutSystems can deserialize JSON into structured data, but the challenge arises when the JSON contains heterogeneous lists (e.g., a mix of arrays and objects in the same array), like your case. The structure you've shared has a deeply nested and inconsistent format, which is not ideal for OutSystems’ default JSON-to-structure generation.
How to Do It in OutSystems
Step 1: Treat the JSON as Text
Use JSON Deserialize with a custom data model only for the part you care about, or manually parse with JavaScript logic (recommended in this case due to structure complexity).
Now Use JavaScript to Extract It (Simple & Effective)
You can use a JavaScript node in a Client Action:
// input: rawJson (Text) from API
var parsed = JSON.parse($parameters.rawJson);
var target = parsed.data[0][1][1]; // navigate to the desired value
$resolve(target); // return it
Create a Text Output Parameter (e.g., ExtractedText) and return the value from $resolve.
Works even if the structure is inconsistent.
Or Also you can ask to change that support in Outsystems in json structure. I hope it would help to proceed.