Open ghost opened 4 years ago
Currently, in JsonSurfer the filter is supported for array structure only. There is not an official standard for JsonPath syntax for now. You can check the differences among JsonPath projects in this repo: https://github.com/cburgmer/json-path-comparison So I'm not sure your expected result is "real" expected. However, if there are a huge demand on your use-case, I can implement it.
We ran into the same issue. It would be awesome if this can be supported.
A second very similar case we encountered: to objects of the same name (instead of using an array). Seems to be a valid json too (at least jackson can process it).
"a": { "size": 15 }, "a": { "size": 20 }
instead of:
"a": [ { "size": 15 }, { "size": 20 } ]
See also https://github.com/cburgmer/json-path-comparison/issues/41
Steps to reproduce
Example JSON:
Queries:
Code:
Expected
The queries
$.*[?(@.size > 13)]
and$[?(@.size > 13)]
return an array of two items:Actual
Both queries return an empty array:
Note
The queries
$.*
and$[*]
return an array of all three items:So I would expect that a filter after a wildcard is working fine.
Environment
JsonSurfer 1.6.0 + Jackson Parser + Jackson Provider.