JSONPath Tester
Test JSONPath expressions on your own JSON in the browser. Filters, slices, recursive descent, paths and JSON Pointers, with ready-made examples.
How to test a JSONPath expression
- Paste your JSON in JSON data, or click Load sample data to use the classic bookstore example.
- Type an expression in JSONPath expression, or pick one from Examples.
- The result updates as you type; Run query runs it again. The status line gives the number of matches.
- Use Show to switch between Values, Paths, JSON Pointers and Paths and values, then copy the result.
JSONPath syntax in a nutshell
| Syntax | Meaning | Example |
|---|---|---|
$ |
the root of the document | $ |
.name or ['name'] |
a child | $.store.bicycle |
* |
every child | $.store.* |
.. |
recursive descent, at any depth | $..author |
[n] |
array index, from 0 | $..book[2] |
[start:end:step] |
slice; negative numbers count from the end | $..book[-1:] |
[a,b] |
union | $..book[0,1] |
[?(expr)] |
filter | $..book[?(@.price < 10)] |
^ |
the parent of each match | $..book[?(@.price > 20)]^ |
~ |
the property name instead of the value | $.store.*~ |
Results are returned in document order. Paths gives normalized paths such as $['store']['book'][0]['title'], and JSON Pointers gives the RFC 6901 form /store/book/0/title, handy for JSON Patch or for the error paths of JSON Schema validators.
Filter expressions: what is supported
Filters are evaluated with jsonpath-plus in safe mode: the expression is parsed and interpreted by a small evaluator, never passed to eval or new Function. Inside [?( … )] you can use:
@for the current item,@.fieldand@['field']for its members,@rootfor the whole document ($is not available inside a filter);- comparisons
==,!=,===,!==,<,<=,>,>=; - logic
&&,||,!, arithmetic+ - * / %and the ternarya ? b : c; - string, number,
true,false,nulland regular expression literals; - methods of the values themselves, for example
@.title.startsWith('S'),@.tags.includes('new')or@.title.match(/lord/i); @property(the key or index of the current item),@parentand@path(its normalized path), in jsonpath-plus style.
Access to constructor, __proto__ and the Function constructor is blocked. If a filter fails on one item, for example @.isbn.startsWith('0') on a book without isbn, that item simply does not match; a syntax error in the expression is reported. Filters written the RFC 9535 way, [?@.price < 10] without parentheses, are accepted and read as [?(@.price < 10)]. RFC 9535 functions such as length(), count(), match() and search() are not available: use JavaScript methods such as @.name.length instead.
Type selectors from jsonpath-plus also work at the end of a path: $..*@number() returns every number, and @string(), @boolean(), @array(), @object(), @null() and @integer() do the same for other types.
Frequently asked questions
Is my JSON sent to a server?
No. Parsing and evaluation happen in your browser, and your data never leaves your computer.
Why does my filter return nothing?
Check that the path before the filter selects an array or object: $.store.book[?(@.price < 10)] filters the books, while $.store[?(@.price < 10)] looks at book and bicycle. A property missing from an item is undefined, so comparisons with it are false.
What is the difference between `==` and `===`?
As in JavaScript, == converts types ("10" == 10 is true) while === compares type and value.
Why is the output limited?
Only the first 10,000 matches are written to the result, to keep the page responsive; the status line gives the full count.
Is JSONPath standardised?
Yes, since 2024, by RFC 9535. Implementations still differ, especially in filters; this tool follows jsonpath-plus, the syntax of Stefan Goessner’s original JSONPath.
Related tools
- JSON Formatter and Validator Free JSON formatter and validator that beautifies, minifies and checks JSON in your browser, with syntax errors reported by line and column.
- JSON Schema Validator Validate a JSON document against a JSON Schema in your browser. Every error is listed with its instance path, keyword and schema path.
- Regex Tester Test JavaScript regular expressions live with highlighted matches, capture groups, replacement and a plain-English explanation of every token.