Nested JSON Deserialization and get specific values

Hi guys, I have below JSON string and I would like to dig to the inner item and get values.

{
   "eventType":"Event-Triggers_default",
   "eventTime":"2021-03-31 10:35:01",
   "event":{
      "parts":{
         "specification":{
            "characteristicsValue":[
               {
                  "characteristicName":"Header.SessionId",
                  "value":"AG_20210331_0000521bca9ed3fa1914"
               },
               {
                  "characteristicName":"ReceiverIdentifierType",
                  "value":"04"
               },
               {
                  "characteristicName":"ActionType",
                  "value":"ChangeOrgAcctStatus"
               },
               {
                  "characteristicName":"InitiatorLastName",
                  "value":"Emma"
               },
               {
                  "characteristicName":"OrderID",
                  "value":"8CVC013NBO"
               },
               {
                  "characteristicName":"ReceiverIdentityId",
                  "value":"201000000000116003"
               },
               {
                  "characteristicName":"ReceiverIdentityType",
                  "value":"5000"
               },
               {
                  "characteristicName":"InitiatorFirstName",
                  "value":"Vingko"
               },
               {
                  "characteristicName":"Channel",
                  "value":"WEB"
               },
               {
                  "characteristicName":"ReceiverAccountList",
                  "value":"{\"list\":[{\"AccountNo\":\"500000000111131065\",\"AccountAlias\":\"BINGO Account\",\"AccountStatus\":\"Active\"},{\"AccountNo\":\"500000000111131073\",\"AccountAlias\":\"Utility Collection Account\",\"AccountStatus\":\"Frozen\"}]}"
               },
               {
                  "characteristicName":"ReceiverIdentifier",
                  "value":"123456"
               },
               {
                  "characteristicName":"InitiatedTime",
                  "value":"20233451103501"
               },
               {
                  "characteristicName":"ReceiverOrganizationName",
                  "value":"KIKO"
               }
            ]
         }
      }
   }
}

So far I have managed to go up to characteristicValue and value of 9th array. I can’t go further than that.

I would like to get ReceiverAccountList > List (0)

Below is the code have used

JSONobj_org("event")("parts")("specification")("characteristicsValue")(9)("value").ToString

to get this:

{"list":[{"AccountNo":"500000000111131065","AccountAlias":"BINGO Account","AccountStatus":"Active"},{"AccountNo":"500000000111131073","AccountAlias":"Utility Collection Account","AccountStatus":"Frozen"}]}

Now I want details of the first array of this output without Deserializing it.

use following statement:

JSONobj_org("event")("parts")("specification")("characteristicsValue").Values(Of JObject).toList

you will get each array item as a JObject within a list
for dynamic retrieval we do feed this into a foreach activity

1 Like

@wilbardmtei
why we are not using Deserializing here

I tried this didn’t work.

I’m avoiding using too many variables.

@wilbardmtei
cross check on my end was working:

first test: the serialized json object
second test: accessing the inner JObjects
third test: accessing the 3rd JObject

Please take a note on following:

  • was tested with a diiferent JObject Var name: myJObject vs. JSONobj_org
  • .Value s (Of JObject).toList - ensure Values is use and not Value

Thanks.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.