JsonPath

https://www.pluralsight.com/blog/tutorials/introduction-to-jsonpath

https://github.com/json-path/JsonPath

https://support.smartbear.com/alertsite/docs/monitors/api/endpoint/jsonpath.html

JSONPath is a query language for JSON, similar to XPath for XML

1. Maven dependency

<dependency>
    <groupId>com.jayway.jsonpath</groupId>
    <artifactId>json-path</artifactId>
    <version>2.1.0</version>
</dependency>

2. Functions and Filters

JsonPath also has functions that can be used to the end of a path to synthesize that path's output expressions: min(), max(), avg(), stddev(), length().

Finally - we have filters; these are boolean expressions to restrict returned lists of nodes to only those that calling methods need.

A few examples are equality (==), regular expression matching(=~), inclusion(in), check for emptiness(empty),. Filters are mainly used for predicates.

For a full list and detailed explanations of different operates, functions and filters, please refer to JsonPath GitHub project.

3 examples: JsonPath.with()

4. examples: read:

Last updated

Was this helpful?