-1

Hey all I am trying to get the values in F_TableOtherFamily->F_Table and loop to get the name and values of whats inside that but I can not seem to do that with using the following code:

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

The json value for msg is:

{
  "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"
    }
  ]
}

The value for child is:

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

I am not sure how to go about looping to get the values inside F_Table??

1 Answer 1

0

a Json reader (like the one from newtonsoft) should solve your problem

Take a look at this

How to read JSON http post response using VB

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.