JSONPath Tester
Free JSONPath tester: evaluate expressions like $.store.book[*].author against your JSON, see each match with its path, and use the examples. Runs in your browser.
How to use JSONPath Tester
- 1Paste your JSON, or press Try example to load a small bookstore document.
- 2Type a JSONPath expression starting with $, or click one of the examples.
- 3Read the matches as JSON, check the path of each match, and copy the result.
What makes it better
- Live results with the number of matches and the path to each
- Wildcards, recursive descent, slices and filter expressions
- Clickable cheat sheet of common expressions
- Filters run in a safe evaluator: your expression is never executed as JavaScript
- Friendly messages for invalid JSON or a malformed expression
About JSONPath Tester
JSONPath Tester evaluates a JSONPath expression against a JSON document as you type and lists the matching values together with the exact path of each one. A cheat sheet of common expressions fills the field with one click, and filter expressions such as [?(@.price < 10)] are supported through a safe evaluator that never runs your text as code. Errors in the JSON or the expression are explained in plain words.
Common uses
- Work out the right expression before putting it in code, a test or an API gateway rule.
- Pull every value of one field, such as all prices or IDs, out of a large response.
- Check why a filter returns nothing by testing it against sample data.
- Learn JSONPath syntax interactively with real output.
Example
Input
{"store":{"book":[{"title":"Sayings of the Century","author":"Nigel Rees","price":8.95},{"title":"Sword of Honour","author":"Evelyn Waugh","price":12.99},{"title":"Moby Dick","author":"Herman Melville","price":8.99}],"bicycle":{"color":"red","price":19.95}}}Result
[ "Nigel Rees", "Evelyn Waugh", "Herman Melville" ]
Good to know
- JSONPath has no single official standard for every feature, so edge cases such as filter syntax can differ between libraries. This tool follows the jsonpath-plus library, so verify an expression in the tool or library you will deploy it with.
- Filter expressions are limited to the safe evaluator, which understands comparisons, logic and simple property access, not arbitrary scripts.
- Results come from a standard JavaScript parse, so integers beyond 2^53 may be rounded in the result. At most 500 matches are listed.
JSONPath Tester FAQ
What is JSONPath?
JSONPath is a query language for JSON in the spirit of XPath for XML. $ stands for the whole document and you add .key, [index], * and .. steps to reach the values you want, for example $.store.book[0].title.
How do I select every item in an array?
Use the wildcard: $.store.book[*] returns every book, and $.store.book[*].author returns just the authors. A slice such as [0:2] returns a range of items instead.
How do I filter by a value?
Use a filter expression such as $.store.book[?(@.price < 10)], where @ is the current item. You can combine tests with && and ||, and check that a field exists with [?(@.isbn)].
What does the double dot (..) do?
It searches at every depth. $..price finds each price key wherever it appears, in books, in the bicycle or anywhere else in the document.
Is it safe to type filter expressions here?
Yes. Filters are interpreted by a restricted evaluator that parses the expression instead of running it as JavaScript, so text such as a function call or an assignment cannot execute code on your device.