JSONPath tester
Paste JSON, write a JSONPath such as $.store.book[?@.price < 10].title, and see what it selects. The evaluator follows RFC 9535, the JSONPath standard, and runs entirely in your browser.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Paste your JSON into the left box. A bookstore example is loaded.
- Type a JSONPath, or press one of the example queries.
- Read the matches: each shows its normalized path and its value. Copy all values as a JSON array, or the paths as a list.
Syntax in short
| Query |
Selects |
$ |
the whole document |
$.store.book or $['store']['book'] |
a member |
$.store.book[0], [-1] |
an array item, counting from the end with a minus |
$.store.book[1:3], [::2], [::-1] |
a slice: start, end (not included), step |
$.store.* or $.store.book[*] |
all children |
$..price |
price at any depth |
$.store.book[0,2] |
several selectors in one segment |
$..book[?@.price < 10] |
items that pass a test |
Filters
Inside [?...], @ is the item being tested. Write @.isbn to test that a member exists, @.price < 10 to compare, and length(@.title) > 8, count(@.*) == 3 or match(@.author, '.*Tolkien') to use a function. match must fit the whole string, search may match any part; both take a regular expression and are run with the browser’s engine.
Example
On the loaded bookstore, $.store.book[?@.price < 10].title selects "Sayings of the Century" and "Moby Dick" at the paths $['store']['book'][0]['title'] and $['store']['book'][2]['title'].
Good to know
Members are visited in the order JavaScript keeps them, so keys that look like integers, such as “10”, come first in an object. Wrongly typed filter arguments give no match rather than an error.
Frequently asked questions
Which JSONPath syntax is supported?
The RFC 9535 core. That is $, .name, ['name'], [index] with negative indexes, [start:end:step] slices, * wildcards, .. recursive descent, comma-separated selector lists, and [?filter] expressions. The filter functions length(), count(), value(), match() and search() are included.
How do filters work?
A filter such as [?@.price < 10 && @.isbn] tests every child of the current array or object. Inside it, @ is the child being tested and $ is the whole document. You can compare with == != < <= > >=, combine with && and ||, negate with !, group with parentheses, or test that a path exists.
Why does my query work in another tool but fail here?
JSONPath had many incompatible implementations before the standard. Things like $.store.book[(@.length-1)] script expressions, single = comparisons or unquoted names after [ are not part of RFC 9535 and are rejected here. Use [-1] and ==.
What is a normalized path?
It is the unique spelling of where a value sits, for example $['store']['book'][0]. Every name is in brackets with single quotes and every index is a number, so two paths to the same value always look the same.
How are missing values compared?
A missing path is different from null. @.a == null matches only items that have "a" set to null, while two missing paths are equal to each other. Ordering comparisons like < work only between two numbers or two strings.