【发布时间】:2014-06-25 05:10:37
【问题描述】:
您好,我在将 dataTable 转换为 JSON 格式时遇到问题,但我无法获得所需的输出。
这里是数据表的例子
Parent Child
P1 c1
P1 c2
P1 c3
P2 c4
我需要的输出是:
[{
Parent:P1,
Child:[
{c1},
{c2},
{c3}
]
},
{
Parent:P2
Child:[{c4}]
}]
但我总是得到的输出是:
[{Parent:P1, Child:c1}, {Parent:P1, Child:c2}, {Parent:P1, Child:c3}, {Parent:P2,
Child:c4}]
【问题讨论】:
-
我用过这个,但仍然没有得到我想要的输出:stackoverflow.com/questions/17398019/…
标签: c# jquery asp.net json datatable