JSON Object parsing with nested Array

Hello all,

I tried to parse json below and I was able to get these nested ID but I was able to deserialize json and create json object but now I’m not able to "enter in events array. Can anyone help? Big thansk in advance

{
“sportId”: 33,
“last”: 210756101,
“league”: [
{
“id”: 204735,
“name”: “ATP Challenger Seoul - R2”,
“events”: [
{
“id”: 982609151,
“starts”: “2019-05-01T02:00:00Z”,
“home”: “Yan Bai”,
“away”: “Evgeny Donskoy”,
“rotNum”: “9359”,
“liveStatus”: 0,
“status”: “I”,
“parlayRestriction”: 2,
“altTeaser”: false,
“resultingUnit”: “Regular”
},
]
}

Hi @ivanhorvat83,
Here is the file which will give you events only: JSON.zip (2.3 KB)

Check and let me know if it is working. I just copied the same json you have provided above

1 Like

Thanks but some activities are missing or could not be loaded properly. What should i do?

Give me a minute… will upload again

JSON.zip (11.8 KB)

@ivanhorvat83,
Is this loaded properly? let me know if any issues again.

Unfortunately not still issues with activities. But ok I understand the process I will try to incorporate it in my project and let you know. Big thanks for the suggestion :slight_smile:

First of all, import, uipath.web.activities and here are the step wise screenshots

  1. use Deserialize JSOn to load it as an object
    image

  2. Use for each to loop through the childs. Here are looping inside the json array “League”
    image

  3. Then loop through the child array “events”
    image

1 Like

Thanks man this is working although i used JOBject as variable type, but now i have another problem :smiley: when I get json from HTTP request it full as it should be (i checked over postman) but later on during processing with ForEach it looses some items and returns only two (last ones) and it should return 28 … do you know should i do some delays? or is there any other catch?

thanks in advance

That’s a strange issue. Test it is reading whether only two. Or if they are coming in different root elements, try concatination method to form a string with all the outputs and get the required text nodes

So i get from league last two and from events i get events from object 28 only one event and it should be two … not sure why.

Yeah, now i got the actual issue. You have to loop through all the objects within the league root element. Just find a way to loop through all the objects :slight_smile:

Problem solved by @HareeshMR. Thanks for the help! :slight_smile:

Please mark as solved when your issue has been fixed.

Hello Ivan,
In this video I do a lot of stuff with JSON (Chapter included) :

3:55 Deserialize a JSON with Array inside
6:00 When we use Deserialize JSON Array activity
7:00 Deserialize a JSON with a List of Strings inside

Thanks,
Cristian Negulescu

1 Like