I am trying to convert datatable to JSON with a special format
Data in a DataTable Follows
col1 col2 col3 col4 --------------------- AB c D1 AB c D2 AB c D3
Try converting it to an array of objects, e.g.
class obj { var col1; var col2; var col3; list<string> col4; }
I'm trying to use linq, but it seems to be stuck.
var result = from row in dt.AsEnumerable() group row by new { c1 = row["col1"], c2 = row["col2"], c3 = row["col3"] } into section select new { item = section.Key };
source share