How to write "If" condition in JSON parsing **refer below example**

Hi - How to “if” condition in below example of JSON.

In below JSON Object “list” is an array. I need to Parse this JSON. But for that I need to write “if” condition.

e.g

if “list” is an array then parse this JSON. ( I need help on how to write this condition)

{

“formula”: “XXXX”,
“list”:
[{
“id”: 343,
“name”: “XXXX”,

     }

,
{

    "id": 400,  
    "name": "XXXX",
 
     }

     ]

}

@navincemk
Checking the Datatype of the value from list would allow to do the conditional Fork
The gettype Method is usually used for this

Give a try on Debugging an Type into the watch Expression yourJObjextvar(“list”).gettype IT should Return JArray

Thanks.

It worked using:
if:
item(“list”).GetType.ToString.Equals(“Newtonsoft.Json.Linq.JArray”)
then:
excute code
else:
execute else code

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