I have C# DataTable in the following 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"
- }
- }
- ]