我有输出表
*/
我希望像下面那样返回JSON对象
ClientName Dno DnoId Dfull DfullId
ClientA AB342A 16711 AB342A-J2015 1
ClientB AB544A 6648 AB544A-J20131 2
ClientB AB544A 6648 AB544A-J20151 3
ClientB AB544A 6648 AB544A-J2015T 4
ClientB BD944A 6679 BD944A-D20131 5
ClientC CA778A 12073 CA778A-J20151 6
我用于此输出的类如下
[{
"ClientName":"ClientA",
"DnoList":[
{
"DnoId":"16711",
"Dno":"AB342A",
"DfullList":[
{
"DfullId":"1",
"Dfull":"AB342A-J2015"
}
]
}
]
},
{
"ClientName":"ClientB"
"DnoList":[
{
"DnoId":"6648",
"Dno":"AB544A",
"DfullList":[
{
"DfullId":"2",
"Dfull":"AB544A-J20131"
},{
"DfullId":"3",
"Dfull":"AB544A-J20151"
},{
"DfullId":"4",
"Dfull":"AB544A-J2015T"
}
]
},
{
"DnoId":"6679",
"Dno":"BD944A",
"DfullList":[ {
"DfullId":"5",
"Dfull":"BD944A-D20131"
} ]
}
]
}]
我正在使用的和linq查询和类如下
public class MyData
{
public string ClientName { get; set; }
public List<DnoList> DnoLists { get; set; }
}
public class DnoList
{
public int DnoId { get; set; }
public string Dno { get; set; }
public List<DfullList> DfullLists { get; set; }
}
public class DfullList
{
public int DfullId { get; set; }
public string Dfull { get; set; }
}
但是我被困了,我怎么能循环通过这个添加上面的三个类来制作所需的输出