I have a json response from API and I need to store that information in a data table. Response is something like :
{
"columns": [
"firstName",
"lastName",
"email",
"password",
],
"rows": [
[
"Alpha",
"Tango",
"AlphaTango@domain.com",
"123"
],
[
"Charle",
"Tango",
"CharlieTango@domain.com",
"456"
]
]
}
I need it to be converted into the format :
firstName lastName email password
Alpha Tango AlphaTango@domain.com 123
Charle Tango CharlieTango@domain.com 456
I did the reverse with the help of below snippet, but am not able to convert json back into data table acceptable format :
JsonConvert.SerializeObject(new {
columns = dt1.Columns.Cast<DataColumn>().Select(x => x.ColumnName),
rows = dt1.AsEnumerable().Select(r => r.ItemArray),
});
Any suggestion or pointers will be highly appreciated