I have C# DataTable in the following format:
DataTable convert to JSON Format
- ID | ParetCode|ChildCode| AttName | AttCode|
- -------------------------------------------------
- 01 | 01 | 001 | att1 | 3 |
- 02 | 01 | 001 | att2 | 456 |
- 03 | 01 | 002 | att1 | 87 |
- 04 | 01 | 002 | att0 | 65 |
- 05 | 02 | 054 | att1 | 54654|
How can I convert that into a Json object as follows?
- [
- {"id":"01","ParentCode":"01","ChildCode":001
- {"AttName":"att1",
"AttCode":3, - "AttName":"att2",
"AttCode":456, - },
"ChildCode":002 - {
- "AttName":"att1",
"AttCode":87, - "AttName":"att0",
"AttCode":65 - }
- {"id":"05","ParentCode":"02","ChildCode":054
- {"AttName":"att1",
- "AttCode":"54654"
- }
- }
- ]


Manas MohapatraRank #182 · 13.2K reputationPosted Aug 28, 2016, 10:59 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 28, 2016, 11:24 PM EDT
ketan borsdiyaRank #2,258 · 624 reputationPosted Aug 29, 2016, 12:32 AM EDT
Vasanth NatarajanRank #3,352 · 429 reputationPosted Aug 29, 2016, 4:09 AM EDT
Vinay SinghRank #604 · 4K reputationPosted Aug 29, 2016, 4:14 AM EDT
Vishal JadavRank #1,692 · 901 reputationPosted Aug 29, 2016, 6:20 AM EDT