JSON.net получает значение в дочернем элементе во время цикла

Привет всем, я пытаюсь получить значения в 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

Значение json для msg:

{
  "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??


person StealthRT    schedule 12.12.2015    source источник


Ответы (1)


читатель Json (например, от newtonsoft) должен решить вашу проблему

Взгляните на это

Как читать HTTP-ответ в формате JSON с помощью VB

person Someone that matters    schedule 12.12.2015