JSONPath Tester
Run JSONPath queries against a JSON document and see each match and its path.
- Runs in your browser
- Nothing is uploaded
- Free, no sign-up
About this tool
Write a JSONPath expression, paste a JSON document, and see exactly what it selects, along with the full path to every match. Filters are parsed and evaluated directly rather than passed to eval(), so you can try expressions against data you do not fully trust.
How to use it
- Paste your JSON into the document pane.
- Type a JSONPath expression starting with $, or pick one of the examples.
- Read the matched values, or switch to Paths to see where each one lives.
Syntax at a glance
| Expression | Selects |
|---|---|
$ |
The whole document |
$.store.book |
A property, by dot notation |
$['store']['book'] |
The same, by bracket notation (needed for names with spaces or dots) |
$.store.book[0] |
An array element; -1 is the last |
$.store.book[*] |
Every element or property value |
$..price |
price at any depth |
$.store.book[1:3] |
A slice, start:end:step, end excluded |
$.store.book[0,2] |
Several indexes or names at once |
$.store.book[?(@.price < 10)] |
Elements for which the filter is true |
Inside a filter, @ is the element being tested and $ is still the document root.
Writing filters
Filters support comparisons (==, !=, <, <=, >, >=), logical &&, || and !, and parentheses.
- Existence:
[?(@.isbn)]keeps elements that have anisbn, and[?(!@.isbn)]keeps those that do not. - Combining:
[?(@.category == 'fiction' && @.price < 10)]. - Comparing with another value in the document:
[?(@.price < $.store.bicycle.price)]. - Length:
[?(length(@.title) > 20)].
Ordering comparisons only succeed between two numbers or two strings. @.price > 5 does not match an element whose price is the string "10".
Where implementations differ
JSONPath began as an informal article in 2007, and libraries disagreed about the details for years. RFC 9535, published in 2024, finally standardised it. This tool follows the RFC for everything it supports.
Two common extensions are not supported: script expressions such as [(@.length-1)], and the regular-expression operator =~. The RFC's match() and search() functions are not yet available either. If your expression relies on them, or on a library-specific behaviour, test it in the library you will actually run it with.
JSONPath, jq or code?
JSONPath is for selecting parts of a document, and it is what many tools and APIs accept as a query language. It cannot reshape or compute: for that, jq on the command line or a few lines of code is the right tool.
When you only need to reformat or validate the document, use the JSON formatter. To turn a sample into types, try JSON to TypeScript.
Frequently asked questions
What is the difference between . and ..?
A single dot selects a child of the current node. A double dot searches the current node and everything beneath it, at any depth, so $..price finds every price anywhere in the document.
Why does my expression return nothing?
Names are case-sensitive, and each step only looks at the nodes the previous step produced. Try $..name with the recursive operator first to see whether the property exists at all.
Can JSONPath select a parent?
Not in the standard. Select the parent directly with a filter on its children instead, for example $.store.book[?(@.isbn)] for books that have an isbn.
Is my JSON sent anywhere?
No. The document and the expression are evaluated in your browser.
Related tools
JSON Formatter & Validator
Pretty-print, minify and validate JSON with precise error positions.
JSON to TypeScript Converter
Generate TypeScript interfaces or types from a JSON sample.
JSON to CSV Converter
Convert JSON arrays to CSV and back, with nested keys flattened.
Diff Checker
Compare two texts side by side with line-level highlighting.