I have converted a JSON to datatable. But don't know how to display it sub array part.
json is :
{
"School": "xxxx",
"Location": "yyyyy",
"TotalStaffs": "50",
"StudentsCount": [
{
"ClassA": "80",
"ClassB": "60"
}
]
}
DataTable dt2 = JsonConvert.DeserializeObject<DataTable>("[" + json + "]");
Now the output is :
School Location TotalStaffs StudentsCount
xxxx yyyy 50
The output should be :
School Location TotalStaffs ClassA ClassB
xxxx yyyy 50 80 60
NB : StudentsCount array is dynamic. There may be only one class sometime. Or may be more than one class. And the resulted table will always contain only one row, as shown in the sample.