I want to generically flatten some json so I can convert to a datatable and bind to a datagrid using c#
What is the best way of doign it, bearing in mind I dont know
Here is one another way to flatten JSON / convert to DataTable using Cinchoo ETL
Flatten JSON:
using (var r = new ChoJSONReader("*** JSON file path ***"))
{
foreach (var rec in r.Select(f => f.Flatten()))
Console.WriteLine(rec.Dump());
}
JSON to DataTable:
using (var r = new ChoJSONReader("*** JSON file path ***"))
{
var dt = r.AsDataTable();
Console.WriteLine(dt.DumpAsJson());
}