{
"allnodes":[
{
"nodes":[
{
"data":{
"parentId":"1",
"nodes":[
],
"name":"a",
"nodescount":0,
"id":"2"
}
},
{
"data":{
"parentId":"1",
"nodes":[
{
"data":{
"parentId":"3",
"nodes":[
],
"name":"b",
"nodescount":0,
"id":"4"
}
}
],
"name":"c",
"nodescount":1,
"id":"3"
}
}
],
"name":"d",
"nodescount":2,
"id":"1"
}
]
}
.net 数据合约
[DataContract]
class Node
{
[DataMember(Name = "id")]
public string id { get; set; }
[DataMember(Name = "name")]
public string name { get; set; }
[DataMember(Name = "parentId")]
public string ParentId { get; set; }
[DataMember(Name = "nodescount")]
public long Nodescount { get; set; }
[DataMember(Name = "nodes")]
public IEnumerable<Node> Nodes { get; set; }
}
wcf 休息电话
[WebGet(UriTemplate = "/abc/nodes",
RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped)]
void GetNodeTree(,
[MessageParameter(Name = "allnodes")]
out Node[] items);
问题: 我遇到的问题是内部节点没有加载正确的信息,顶级工作,我似乎无法得到我的数据合同中缺少的东西?