JSONPath Query Tool
Execute JSONPath expressions against JSON data to extract, filter, and explore nested structures.
About this tool
Paste any JSON document and run JSONPath queries to extract exactly the data you need. Supports root ($), child (.key), recursive descent (..key), wildcards ([*]), array indices, unions, and filter expressions like [?(@.age > 18)]. Results are displayed as highlighted JSON with a query history for quick re-runs.
How to use
- 1 Step 1: Paste or type your JSON data into the input panel on the left.
- 2 Step 2: Enter a JSONPath expression in the query field (e.g. $.store.book[*].author).
- 3 Step 3: Click 'Run Query' or press Ctrl+Enter to execute.
- 4 Step 4: View the matched results as highlighted JSON. Click 'Copy Result' to copy to clipboard.
What JSONPath is for
JSONPath is a query language for JSON, the way XPath is a query language for XML. Instead of writing loops to dig through nested objects and arrays, you write one compact expression that describes where the data you want lives, and the engine walks the structure and returns every matching value. This tool runs JSONPath expressions against JSON you paste, entirely in your browser, and shows the matched values with syntax highlighting and a match count. It's distinct from a JSON formatter or validator: those check and pretty-print the whole document, whereas JSONPath extracts specific pieces from it.
The syntax, piece by piece
Every expression begins with $, the root of the document. From there you chain steps:
| Syntax | Meaning | Example |
|---|---|---|
.key or ['key'] | Child by name | $.store.bicycle |
[n] | Array element by index | $.store.book[2] |
[-1] | Index from the end | $.store.book[-1] |
[*] or .* | Every element/value (wildcard) | $.store.book[*].author |
.. | Recursive descent — search at any depth | $..price |
[a,b] | Union — several indices or keys at once | $.store.book[0,2] |
[?(...)] | Filter — keep elements matching a condition | $.store.book[?(@.price < 10)] |
Inside a filter, @ refers to the current element being tested. This engine supports existence checks (?(@.isbn) keeps items that have an isbn field) and comparisons with ==, !=, >, <, >=, and <= against a number, a quoted string, or true/false/null.
A worked example
Using the bookstore JSON the tool loads by default — a store with an array of four book objects and a bicycle — here is how a few queries resolve:
$.store.book[*].authorwalks every book and pulls its author, returning all four author names.$..priceuses recursive descent to find everypriceanywhere in the tree — the four book prices and the bicycle's, five matches in total. The leading$.storeis unnecessary because..already searches everywhere.$.store.book[?(@.price < 10)]filters the book array to just those under $10 — the two cheapest books — returning the whole object for each match, not only the price.$.store.book[?(@.category == 'fiction')]keeps the three fiction titles; note the single quotes around the string value.$.store.book[?(@.isbn)]is an existence filter: it returns only the books that carry anisbnfield, ignoring the two that don't.
The results panel shows the count (e.g. "5 matches") and pretty-prints the matched values; a single match is returned as the value itself, multiple matches as an array.
Filter vs. wildcard: a common confusion
A wildcard [*] returns every element; a filter [?(...)] returns only elements that pass a test. People often reach for a filter when they mean a wildcard, or forget that a filter only operates on an array — in this engine, applying [?(...)] to a plain object yields nothing. So query the array, then filter: $.store.book[?(@.price >= 10)] works, but pointing a filter at a single object does not.
Practical tips
- Use
..when you don't know the depth. If a field is buried at varying levels,$..fieldNamefinds them all without spelling out the path. - Quote string comparisons. Write
@.status == 'active', not@.status == active— an unquoted bare word won't match. - Test incrementally. Start with
$.store, confirm it returns the object, then add one step at a time. The match count tells you immediately when a step narrows to zero. - Click a sample query to load both the expression and the example JSON, then edit from there — the fastest way to learn the syntax by experiment.
- Remember
$matches one value, not a list. Returning multiple values requires a wildcard, union, recursive descent, or filter somewhere in the path.
Where JSONPath is genuinely useful
It shines for pulling a few fields out of large API responses, writing assertions in API tests ("the response has at least one order with status shipped"), configuring data pipelines and log processors, and exploring an unfamiliar JSON payload without writing throwaway code. Many tools — from jq-style processors to test frameworks and no-code platforms — accept JSONPath-style expressions, so the syntax transfers widely.
Everything runs locally
The JSON you paste and every query you run are processed entirely in your browser by a JavaScript engine; nothing is uploaded. That means you can safely test queries against sensitive or proprietary JSON, and the tool keeps working with your network disconnected. (Note this is a focused JSONPath implementation covering the operators above; very advanced extensions like array slices and script expressions aren't part of it.)