JsonPath not working

I am trying to apply the JsonPath:$.Party.aRolePlayer.Person.Registration[?(@.typeName = ‘ECN’)].externalReference

on the following Json and it is not working. I get a blank response. It works fine https://jsonpath.curiousconcept.com/.

{ 
        "Party": { 
                "retrievalLevel": 2099, 
                "aRolePlayer": { 
                        "Person": { 
                                "Registration": [ 
                                        { 
                                                "typeName": "something1", 
                                                "externalReference": "abcdefgh" 
                                        }, { 
                                                "typeName": "something2", 
                                                "externalReference": "12345678" 
                                        } 
                                ] 
                        } 
                } 
        } 
} 

I am guessing the JsonPath implementation inside EDGE do not support this particular syntax ?

I know we have a bug in Edge which can’t handle with complex json with nested json structure. See https://apigeesc.atlassian.net/browse/APIRT-860 for more details. It is not fixed yet.

Thanks @arghya das

…and your workaround, of course, is to just use a Javascript callout to extract that field.

1 Like

This question is from a long time ago, of course… but as of 5-6 years ago, at least, this works in Apigee. Using this JSON:

{
  "Party": {
    "retrievalLevel": 2099,
    "aRolePlayer": {
      "Person": {
        "Registration": [
          {
            "typeName": "ECN",
            "externalReference": "abcdefgh"
          },
          {
            "typeName": "something2",
            "externalReference": "12345678"
          }
        ]
      }
    }
  }
}

with this query

$.Party.aRolePlayer.Person.Registration[?(@.typeName == 'ECN')].externalReference

I get the expected

[
  "abcdefgh"
]
1 Like