JSONPath Tester
Paste a JSON document, type a JSONPath expression such as $.store.book[*].author, and the matches appear straight away, each with its normalized path and type. Click an example to try filters like $..book[?(@.price < 10)], slices, unions and recursive search. Invalid JSON and invalid paths give a clear error with the position. The document never leaves your browser.
- $['store']['book'][0]['author']string
"Nigel Rees"
- $['store']['book'][1]['author']string
"Evelyn Waugh"
- $['store']['book'][2]['author']string
"Herman Melville"
- $['store']['book'][3]['author']string
"J. R. R. Tolkien"
JSONPath is a query language for JSON, like XPath for XML. The path starts at the root, written $, and each step narrows the result: .name or ['name'] picks a key, [0] or [-1] picks an array item, [*] or .* picks everything, [1:3] slices, [0,2] picks several, ..name searches at any depth, and [?(@.price < 10)] keeps the items where the test is true, with @ standing for the item being tested. Tests can use == != < <= > >= and combine with &&, || and !. A comparison with a missing value is false, except !=. The syntax follows the common Goessner form and the main features of RFC 9535, but not every extension, such as script expressions. The example is the bookstore document from the original JSONPath article. Everything is worked out in your browser.
Related Tools
[5 suggestions]JSON Formatter
Validate, pretty-print, and minify JSON with clear error reporting for invalid input.
Developer & WebJSON to CSV Converter
Convert a JSON array of objects into downloadable CSV with automatic headers.
Developer & WebJSON to TypeScript Converter
Paste JSON and get TypeScript interfaces or types, with optional keys, unions and nested types worked out from your sample.
Developer & WebJSON to YAML Converter
Convert JSON data into clean, readable YAML configurations instantly with customizable formatting.
Format ConversionRegex Tester
Test regular expressions against a string, highlight matches, and inspect capture groups.
Developer & WebAbout the JSONPath Tester
JSONPath is a query language for JSON, in the way that XPath is for XML. A path starts at the root, written $, and each step narrows the result. A name step, written .name or ['name'], picks a key. A number step, such as [0] or [-1], picks an array item, counting from the end when negative. A wildcard, written [*] or .*, picks every child. A slice such as [1:4:2] takes a range with a step, a union such as [0,2] picks several, and a double dot, as in ..price, searches at any depth. A filter, written [?(@.price < 10)], keeps the items for which the test is true, with @ standing for the item being tested. Tests use == != < <= > >= and can be combined with && and || and negated with !, and a bare @.isbn keeps items that have that key. The tester follows the common syntax from Stefan Goessner's original JSONPath article and the main features of RFC 9535, and the example is the bookstore document from that article: $..book[?(@.price < 10)] finds two books and $..book[?(@.isbn)] finds two. Results show the normalized path of every match, such as $['store']['book'][2]['title'], which is useful for finding where in a large document a value lives. A comparison with a missing value is false, except for not equal. Script expressions and some library-specific extensions are not supported.
What is JSONPath?▾
It is a query language for picking values out of JSON using a path of steps from the root, written $. For example, $.store.book[0].title picks the title of the first book. It does for JSON what XPath does for XML.
How do I filter an array in JSONPath?▾
Use a filter in brackets: $.items[?(@.price < 10)] keeps the items whose price is under 10. The @ stands for each item. Combine tests with && and ||, and check that a key exists with [?(@.isbn)].
What does the double dot mean in JSONPath?▾
It is recursive descent: ..price finds every key named price at any depth below the current node, which is handy when you do not know exactly where a value sits.
Why do I get no matches?▾
Common reasons are a misspelled key, a wrong index, a filter comparing a number with a string, or a path that does not start with $. Try the wildcard version of the path first to see what exists.
Is my JSON uploaded?▾
No. The query runs in your browser and nothing you paste is sent anywhere.