I have json data in coming in dynamic in Web API and need to read through data but I am getting no where, also not sure how I can declare following below json data as string or dynamic in c# class?
json data
{
"sessionA": [
{
"order": 0,
"type": "hidden",
"name": "formId",
},
{
"order": 0,
"type": "hidden",
"name": "consultationId",
},
{
"order": 0,
"type": "hidden",
"name": "clientId",
}
],
"sessionB": [
{
"order": 0,
"type": "heading",
"label": "Super Quiz",
"name": "title",
"value": "Super Quiz",
"validations": []
},
{
"order": 5,
"type": "separator",
"label": "",
"name": "separator",
"value": "",
"validations": []
}
]
}
c# test console class
class Program
{
static void Main(string[] args)
{
dynamic myjson = " {
"sessionA": [
{
"order": 0,
"type": "hidden",
"name": "formId",
},
{
"order": 0,
"type": "hidden",
"name": "consultationId",
},
{
"order": 0,
"type": "hidden",
"name": "clientId",
}
],
"sessionB": [
{
"order": 0,
"type": "heading",
"label": "Super Quiz",
"name": "title",
"value": "Super Quiz",
"validations": []
},
{
"order": 5,
"type": "separator",
"label": "",
"name": "separator",
"value": "",
"validations": []
}
]
}
";
Console.WriteLine("dynamic json convert to object");
Console.WriteLine("---------------------------------");
Console.Read();
}
}