What Is JSONPath?
JSONPath is a declarative query language designed to extract, navigate, and slice specific data fragments from JavaScript Object Notation (JSON) documents. Originally specified by Stefan Goessner and formalized in RFC 9535, JSONPath provides for JSON what XPath provides for XML: an expressive, standardized syntax for traversing deeply nested structures without writing custom recursive algorithms.
Developers, QA test automation engineers, and data analysts routinely use JSONPath in tools like Postman, REST Assured, Kubernetes kubectl output filtering, AWS Step Functions, and API gateway transformations to validate responses and extract dynamic properties.
How to Test JSONPath Expressions Online
Evaluating queries against your JSON document takes just seconds:
- Input JSON Payload: Paste raw JSON directly into the editor on the left or upload a
.jsonfile. - Type Your JSONPath Query: Enter your expression in the top query bar (e.g.
$.store.book[*].author) or pick a query pattern from the Preset Expressions dropdown. - Instant Evaluation: The matching nodes, scalar values, or sub-arrays are extracted and pretty-printed in real time in the right-hand output window, complete with match counts and status badges.
- Copy or Export: Copy the query results directly to your clipboard or download them as a standalone JSON file.
Click to Find JSONPath
Constructing complex query syntax for deeply nested objects with mixed dictionaries and arrays can be error-prone. TinyTools includes a visual Click-to-Find Path tool. Click the Click-to-Find tab above the input editor to convert your JSON payload into an interactive visual tree. Clicking on any key or value immediately computes the exact JSONPath path expression (such as $.store.book[1].price) and inserts it into the query bar automatically.
JSONPath Syntax Reference
Master the standard operators and symbols used in JSONPath queries:
| Operator | Description | Example Syntax | Meaning |
|---|---|---|---|
| $ | Root object or array | $ | The root context of the JSON payload |
| .key | Dot-notated child property | $.store.book | Accesses child property named "book" |
| ['key'] | Bracket-notated child property | $['store']['book'] | Alternative syntax supporting special characters or spaces |
| ..key | Recursive descent search | $..author | Finds all "author" properties at any nesting depth |
| * | Wildcard selector | $.store.book[*] | Matches all elements or properties of the collection |
| [n] | Array index selector | $.store.book[0] | Selects the first element in the array |
| [start:end:step] | Array slice notation | $.store.book[:2] | Selects array elements from index 0 up to index 2 |
| [?(@.exp)] | Filter predicate expression | $.store.book[?(@.price < 10)] | Filters array items matching the given boolean condition |
Filtering Arrays with JSONPath
Filter expressions are among JSONPath's most powerful capabilities. Denoted by [?(<expression>)], the filter evaluates an expression against every item in an array:
- Current Node Variable (
@): In a filter expression,@refers to the individual item being inspected (e.g.@.price). - Comparison Operators: Support for standard comparisons including
==,!=,<,<=,>, and>=. - Existence Checks: Test if a property exists on an item regardless of value using
$.store.book[?(@.isbn)].
Common JSONPath Query Examples
Using the standard bookstore sample data, here are the most commonly utilized JSONPath expressions:
["Nigel Rees", "Evelyn Waugh", "Herman Melville"]
[8.95, 12.99, 8.99, 19.95]
{"category": "reference", "author": "Nigel Rees", ...}
Matches books with prices 8.95 and 8.99
Related Developer Tools
Pair your JSONPath workflows with our complete collection of client-side developer utilities: