Open
Description
I'm trying to suppress all the exceptions when evaluating a JSON path. but when I upgrade the JSON path lib to 2.7, it seems like it is not working as expected.
For example:
var node = objectMapper.readTree("{\"test\" : null}");
JsonPath.using(Configuration.builder()
.options(Option.SUPPRESS_EXCEPTIONS).build())
.parse(node.toString())
.read("$.test[?(@ != null)]");
we got an exception thrown.
Filter: [?] can not be applied to primitives. Current context is: null
com.jayway.jsonpath.InvalidPathException: Filter: [?] can not be applied to primitives. Current context is: null
when i remove a toString() method, it return an empty array.
but if we remove a toString() method and try with another path(example below), it return null
var node = objectMapper.readTree("{\"test\" : \"value response\" }");
JsonPath.using(Configuration.builder()
.options(Option.SUPPRESS_EXCEPTIONS).build())
.parse(node)
.read("$.test");
expected : "value response"
actual : NullNode
Metadata
Metadata
Assignees
Labels
No labels