How to fetch the values from json by iterating through it?

Sample json .

I want to fetch message (value) and error (value) and also errors(value)

How to iterate through this json object ?

1 Like

To get valued from message part after deserialisation use a for each activity and pass the deserialised variable as input

Inside the loop use a assign activity like this

Str_messagevalue = item(“acdvreqresponse”)(“message”)(“value”)

Same for error value

Str_errorvalue = item(“acdvreqresponse”)(“error”)(“value”)

For errors value

Str_errorsvalue = item(“acdvreqresponse”)(“errors”)(0)(“value”)

Hope this helps

Cheers @Ragavi_Rajasekar

Is there a way to iterate through the json and fetching values without knowing the property name.? Like whatever be it either message or error or errors or anything (which we won’t know ) ,we just have to iterate as much as it’s there and get the values . Is it possible.

1 Like

Check this video
U will get more insights

Hope this clarifies

@Ragavi_Rajasekar

Hi @Ragavi_Rajasekar ,

Could you maybe check with the below Expression :

jObj.SelectTokens("$..value").Select(Function(x)x.ToString).toArray

Here, jObj is a variable of type JObject which is the output of Deserialize Json activity.

From Debug Panel :
image

1 Like

Thank you , it worked

1 Like

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