Need to extract multiple data from JSON

Hi Team,
I get a json output from my REST API command like below,
{
“options”:[
{
“labelName”:“Label1”,
“labelValue”:“Value1”
},
{
“labelName”:“Label2”,
“labelValue”:“Value2”
},
{
“labelName”:“Label3”,
“labelValue”:“Value3”
}
]
}

How can I get all the labelName & labelValue?
Please help

@Aditya_Singhania
give a try on following

  • Use deserialize JSON on the JSON string - myJObject
  • Use a for each - typeArgument: JObject - Values: myJObject(“options”).Cast(Of JObject)
  • then access the values e.g. item(“LabelName”)

Find starter help here:
GetJarray_LoopJObject.xaml (5.8 KB)

1 Like

@ppr Thanks a lot for your quick reply & help.
Appreciate the help.
One more query i have , had the json been like this then
{
“options:”
{
“testnode”:[
{
“labelName”:“Label1”,
“labelValue”:“Value1”
},
{
“labelName”:“Label2”,
“labelValue”:“Value2”
},
{
“labelName”:“Label3”,
“labelValue”:“Value3”
}
]
}
}
Then what expression shall we write in deserialize json activity & the for each activity,
If possible please provide your valuable input to this my question.
Thanks

give a try on:
myJObject(“options”)(“testnode”).Cast(Of JObject)

Hi @ppr, how can I pass any variable in body I tried passing it but getting an error
“{”“username”“:”“testusername”“,”“password”“:”“12345678"”}" → without any variable
How can I pass my username & password as a variable, please help me

didnt get you. May we ask you to ask different or to open a new topic in case of the question is not related to the original topic. Thanks

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