A JSONPath tester for building and debugging queries
JSONPath is a small query language for picking values out of JSON, much as XPath does for XML. This JSONPath tester evaluates your expression against your own document as you type and shows every match, so you can refine a query here before placing it in code, a test assertion, an API gateway rule or a monitoring check.
The result is always a JSON array, and the status bar reports how many items matched, for example 2 matches for $.store.book[?(@.price < 10)].title. An empty array with 0 matches means the expression is valid but found nothing.
Syntax reference with results
All results below come from the bookstore sample, which has four books and a bicycle under $.store.
| Expression | Meaning | Result |
|---|---|---|
$ | The root document | The whole input |
$.store.bicycle.color | Child by name (dot notation) | "red" |
$['store']['bicycle'] | Child by name (bracket notation) | The bicycle object |
$.store.book[*].author | Wildcard: every element | 4 authors |
$..price | Recursive descent: at any depth | 5 prices, bicycle included |
$.store.book[0,1].title | Union of indexes | First two titles |
$.store.book[0:2].title | Slice, end excluded | First two titles |
$.store.book[-1:] | Negative slice: last element | The Tolkien book |
$..book[?(@.isbn)].title | Filter: property exists | 2 titles |
$..book[?(@.price < 10)].title | Filter: comparison | 2 titles |
Writing filters
Inside [?( )], the symbol @ stands for the element being tested. You can compare with ==, !=, <, <=, > and >=, and combine conditions with && and ||:
$..book[?(@.category=="fiction" && @.price > 10)].author
returns:
[
"Evelyn Waugh",
"J. R. R. Tolkien"
]
Filters are run by a restricted expression evaluator rather than by JavaScript's eval, which limits what a pasted query can do in your browser. When an expression cannot be understood, the status bar says so, as in Invalid JSONPath expression: Expected expression after == at character 9.
Values or paths
The Return option decides what each match looks like. Matched values gives you the data itself. Matched paths gives the location of each match in normalized bracket form, which helps when you need to know which elements a filter selected:
["$['store']['book'][0]", "$['store']['book'][2]"]
That is the paths result for $..book[?(@.price < 10)]: the first and third books. The Indent option only affects how the result array is laid out.
Common mistakes
- Leaving out the root. This tester tolerates
store.book[0], but many libraries require the leading$, so always include it. - Using
=instead of==in a filter. - Expecting a single value. Even a query that matches one item returns an array, so your code may need
[0]. - Over-matching with
...$..pricealso picks up the bicycle price; use$.store.book[*].priceif you only want books. - Keys with special characters. A key like
ship-tomust be written$['ship-to'].
Dialects and portability
Queries are evaluated with the jsonpath-plus library, which follows the original JSONPath syntax described by Stefan Goessner and adds a few extensions. JSONPath was standardized in 2024 as RFC 9535, and libraries still differ in edge cases such as filter syntax and how slices behave. Test a query with the library your application will actually use before relying on anything unusual.
To discover the path of a field in the first place, list them all with the JSON navigator. For XML documents, the XPath tester plays the same role. Your JSON and queries are processed in the browser and are not uploaded, unless you use Load URL or Save & Share.