Working with nested JSON
Question
Application Type
Reactive

Hello,

Im working on an app where i need to use values from a nested JSON object. Im currently trying to create a list of data that uses the following json object seen in this image: 


Problem is that im trying to create a list from these values that have "SystemID", "ID" and "Name".

Im getting ID and Name values correctly, but im having trouble to get the SystemID value into the list. I need to create a listitem according to each entity inside "Roles". How can i achieve it so my list displays all the correct values and is as long as "roles"? 

For example: "mySystem" needs to have four list entities with different values except "mySystem" because "Roles" contains combined four entries.

This error is only related to proper structure to hold the value of json. You should create a structure with same hierarchy as json response and it will work without any issue.

You can get an idea from any online converter to get the proper structure of Structure, like https://json2csharp.com/

It will be helpful if you can share oml for this, so we can check what is the issue with structure.

regards


Hello,

Unfortunately i cannot share the oml, due this being an customer project.
What i was talking about that i need to have a list row with values like this:

"mySystem" - "ID" - "myRole" etc. And the amount of the rows is determined by the length of "Roles".


No issue. If you can't share the OML file. Could you please share complete response text mentioned above. Right now its an image so I can't copy the json data in my studio for test.

Hey,
You should have structure like shown below

Here JsonOutPut list will be the output json object.

I think the issue you had just because of datatype of ID, can you please confirm that and loop on list to fetch data.

Hope This will help you.

Thanks

Yogesh

Thanks for your reply. Every entity inside the json is string, theres no integers in it. Problem is that i need to have listrows that have first value "systemID" according to the number of corresponding "Roles" objects. 

Currently im looping the values and have to use "roles" to define the length of the list. Im having trouble accessing "systemID" value due it being before "Roles" inside the json. How could i access that value and how could i display it in the list.

In the image "mySystem" is the systemID value, and 2 rows in the list are defined by the length of "roles".


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.