Main.xaml (16.1 KB)
Hi,
I’ve been looking for a way to get each object from json array of objects with no luck so far. I cant seem to find anything that would work on the topic on forums. Could someone help me please?
Thanks a lot
Main.xaml (16.1 KB)
Hi,
I’ve been looking for a way to get each object from json array of objects with no luck so far. I cant seem to find anything that would work on the topic on forums. Could someone help me please?
Thanks a lot
There are two items in your JSON array to start with. Tell the for each loop which you want to access then you can access each of the value pairs by name.
For Example:
FOR EACH ITEM IN
Arr(0)(“itemData”)(“SpecificContent”)
MESSAGEBOX
item.tostring
That will give you each item in SpecificContent, you can then select the data you need based on that.
Main.xaml (18.4 KB)
Thanks!
It helped me, but I still dont get how can I iterate over every json object. I need to do two things with this. 1. separate the objects and then send them to queue 2. get just the RequestNr into some array
Thanks for all the help
You can feed each item in the array to the foreach loop as a JToken. Then access each value using the unique field headers.
jtoken(“itemData”)(“SpecificContent”)(“RequestNr”).ToString
@ronanpeter is it possible for you to share an example of this? I seem to be getting an “overload resolution failed” error
This is an example I shared before. A JSON file based on football fixtures.
It takes the argument Trim(jo_MatchInfo(“matches”)(1)(“homeTeam”).ToString)
This asks for the details of the home team in the first match.
It returns the following:
If you wanted to go further and just return the team name, you can add an additional parameter to the argument:
Trim(jo_MatchInfo(“matches”)(1)(“homeTeam”)(“name”).ToString)
JSON.SimpleExample.zip (2.9 KB)
Thanks for the example, very nice.
However when testing it I noticed that Trim(jo_MatchInfo(“matches”)(1)(“homeTeam”)(“name”).ToString) shows the hometeam of the second match.
The 1 can be changed to a 0 to see the first match.