【发布时间】:2016-03-18 01:28:45
【问题描述】:
嘿,我正在尝试获取 F_TableOtherFamily->F_Table 中的值并循环获取其中内容的名称和值,但使用以下代码似乎无法做到这一点:
For Each msg As JObject In json1("entry")
Dim results As List(Of JToken) = msg("content")(formName).ToList()
For Each pair As JProperty In results
pair.CreateReader()
If pair.Descendants.Count > 1 Then
'has more values (like in a TABLE)
For Each child In pair
'not sure how to get other values
Next
Else
'It only has one value
Debug.Print(pair.Name)
Debug.Print(pair.Value.ToString)
End If
Next
Next
msg 的 json 值为:
{
"content": {
"@type": "application/xml",
"F_Form1": {
"@uid": "fb1ad4ec",
"F_TableOtherFamily": {
"F_Table": {
"F_OtherFamilyName": "BLANK1",
"F_OtherFamilyID": "BLANK2",
"F_OtherFamilyRelation": "BLANK3"
}
},
"F_ReceivedYorN": "Y",
"F_ContractNumber": "901841586"
}
},
"link": [
{
"@href": "../../../../../secure/org/data/c76df8888ada/F_Form1/fb1ad4ec",
"@rel": "edit"
}
]
}
child 的值为:
{
"F_Table": {
"F_OtherFamilyName": "BLANK1",
"F_OtherFamilyID": "BLANK2",
"F_OtherFamilyRelation": "BLANK3"
},
"F_Table": {
"F_OtherFamilyName": "BLANK1-1",
"F_OtherFamilyID": "BLANK2-2",
"F_OtherFamilyRelation": "BLANK3-3"
}
}
我不确定如何循环获取 F_Table 中的值??
【问题讨论】:
标签: json vb.net json.net json-deserialization