navincemk
(Navin Ranjan)
1
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",
}
]
}
ppr
(Peter)
2
@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
navincemk
(Navin Ranjan)
3
Thanks.
It worked using:
if:
item(“list”).GetType.ToString.Equals(“Newtonsoft.Json.Linq.JArray”)
then:
excute code
else:
execute else code
system
(system)
Closed
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.