JSONPath Tester
Query JSON with a JSONPath expression.
About JSONPath Tester
A JSONPath tester runs a path expression such as $.store.books[*].author against a JSON document and lists every match with its path, updating as you type.
How to use
- Paste or load the JSON document on the left.
- Type a JSONPath expression. The default
$matches the whole document; the result updates with every keystroke. - Read the matches as a JSON array in the first output and the normalised path of each match, such as
$['store']['books'][0]['author'], in the second. - Copy either output, or download the matches as a
.jsonfile.
Supported syntax
| Syntax | Meaning |
|---|---|
$ |
The root document |
.name or ['name'] |
A member of an object; quoted names may contain dots and spaces |
[0], [-1] |
An array item; a negative index counts from the end |
* or [*] |
Every member or item |
..name, ..*, ..[0] |
Recursive descent: the selector applied at every depth |
[0,2], ['a','b'] |
A union of indexes or names |
[start:end:step] |
An array slice with Python rules: end is exclusive, any part may be omitted, a negative step reverses |
Filter expressions [?(@.price < 10)] and script expressions [(@.length-1)] are not supported; the tool says so instead of returning nothing. A missing member or an out-of-range index simply produces no match. A path without the leading $ is accepted.
Example
{"store": {"books": [{"author": "Austen", "price": 8}, {"author": "Eco", "price": 12}]}}
$.store.books[*].author → ["Austen", "Eco"]
$..price → [8, 12]
$.store.books[-1:] → [{"author": "Eco", "price": 12}]
Privacy
The query runs in the browser. No request is made, and nothing is stored.
Frequently asked questions
- What is JSONPath?
- JSONPath is a query language for JSON, in the way XPath is for XML. An expression starts at the root ($), walks down members and array items, and can use wildcards, recursive descent, unions and slices to select many values at once. It was proposed by Stefan Goessner in 2007 and standardised as RFC 9535 in 2024.
- What is the difference between $.name and $..name?
- A single dot selects a direct member of the current object, so $.name matches only a top-level "name". Two dots descend recursively and match "name" at any depth.
- How do I select the last element of an array in JSONPath?
- Use a negative index: $.items[-1] returns the last item, and $.items[-2:] returns the last two. Older implementations needed the script form [(@.length-1)], which this tool does not support.
- What is the difference between JSONPath and jq?
- JSONPath only selects values from a document. jq is a full command-line language that can also transform, filter and build new JSON. Simple jq paths such as .store.books[0].author have a JSONPath equivalent, $.store.books[0].author.