I have Web API dynamic returns as follow:
{
"result": true,
"payload": {
"data": [
{
"class": "Platinum",
"name": "William",
"title": "Mr."
},
{
"class": "Silver",
"name": "Susan",
"title": "Ms."
},
{
"class": "Platinum",
"name": "Jack",
"title": "Mr."
}
]
}
}
I need to determine if that json returning has an array object named "data" and the get it’s parent object (in the above case the parent object is "payload" so I would able to retrieve the array value by using eg.
(JArray)jo[payload][data]
I need advice, thank you so much in advance
2
Answers
You can use libraries like
Newtonsoft.Json
to parse and check.you can use somethin like this