Utilizing the jsonpath-plus module (typescript), I am currently working on navigating to a specific object within a json document. The target object is nested several levels deep, requiring passage through 2 levels of arrays. When using the following jsonpath statement:
$..['gmd:DQ_AbsoluteExternalPositionalAccuracy']
The online jsonpath test website jsonpath.com returns the following result:
[
{
"gmd:nameOfMeasure": {
"gco:CharacterString": "Difference to ICESat LE90"
},
"gmd:result": {
"gmd:DQ_QuantitativeResult": {
"gmd:valueUnit": {
"@xlink:href": "http://www.opengis.net/def/uom/OGC/1.0/metre"
},
"gmd:value": {
"gco:Record": {
"gco:Real": "0.655608"
}
}
}
}
},
...
In this scenario, I aim to retrieve the last object (with the label "Absolute vertical accuracy LE90"), but its position may vary. Adding a filter statement like
[?(@['gmd:nameOfMeasure']['gco:CharacterString']=="Absolute vertical accuracy LE90")]
to the original jsonpath expression results in the updated expression
$..['gmd:DQ_AbsoluteExternalPositionalAccuracy'][?(@['gmd:nameOfMeasure']['gco:CharacterString']=="Absolute vertical accuracy LE90")]
However, the filter does not affect the outcome. Experimenting with the same expression on the Jayway jsonpath implementation for java at successfully filters the result down to the desired object.
If anyone could provide guidance on properly filtering this result set using jsonpath-plus, it would be greatly appreciated.