Loop through JsonObject

Hi,

I have obtained a JSON as the out of an HTTP call in the UiPath project. I need to loop through each of the names and dob in the JSON for further development. While using for each its shows an error - implicit conversions from Object to System.Collections.IEnumerable is disallowed. The requirement is that I need to loop through each of the names and dob. Are there any methods to achieve my goal.??
Any help would be highly appreciated. The sample JSON is mentioned below.

Sample JSON

{
“employees”: [
{
“name”: “Nieves Callahan”,
“dob”: “1994/02/21”
},
{
“name”: “Guadalupe Thomas”,
“dob”: “1976/03/19”
},
{
“name”: “Mason Wall”,
“dob”: “1989/11/03”
},
{
“name”: “Ruby Hampton”,
“dob”: “1976/11/16”
}
]
}

Thanks

1 Like

Consider json file as a text file and use read text file activity.
and split by using vbNewLine and loop with maximum line count which will come with UBound of out put.
Hope my inputs are useful.

Hi @manu.naico

You can try to convert your json to datatable then do the iteration. you can use this components for your reference.

https://go.uipath.com/component/json-jarray-conversion-activities

cheers :smiley:

Happy learning :smiley:

4 Likes

LoopJson.xaml (7.1 KB) Jsonfile.Json (239 Bytes)

Try this…! @manu.naico

Thanks!

9 Likes

@manu.naico

Use below point to achieve this:

  • Just iterate the object in for each.
  • using assign take each object value as item(“name”) for name.

Hope it will work for you!!!

Cheeers @manu.naico

1 Like

Works fine… You saved my day… Thanks

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.