Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
6
Answers
DataTable convert to JSON Format
Ekrem Tapan
8y
307
1
Reply
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"
}
}
]
Post
Reset
Cancel
Answers (
6
)
Next Recommended Forum
how to stop refreshing contents of master page in asp.net
drop down list select value bind in data list .net c#