JSONPath Evaluator
Evaluate a JSONPath (RFC 9535) expression against JSON and see every matching value, instantly in your browser.
Your JSON and JSONPath expression are evaluated in this browser and are never sent to Docspira. Learn more.
About JSONPath
JSONPath is a query language for selecting values out of a JSON document, the way XPath selects nodes out of XML. This tool follows RFC 9535, the IETF standard for JSONPath syntax and semantics, using the json-p3 engine; it does not add any non-standard selectors, and its filter expressions cannot run arbitrary JavaScript.
$ is the root of the document. Properties are selected with dot notation ($.store) or bracket notation with quotes ($['store']); bracket notation is required for names with spaces, dots, or other characters that are not valid after a bare dot. Array elements are selected by index ($.store.book[0]), by wildcard for every element ($.store.book[*]), or by slice ($.store.book[0:2]). Recursive descent ($..price) searches every level of the document, not just the top level, for a matching name. Filter expressions ($.store.book[?@.price < 10]) select array or object members using comparisons and the five functions RFC 9535 defines (length(), count(), match(), search(), value()); nothing else is evaluated.
Your JSON and JSONPath expression never leave this browser tab; there is no network request involved in evaluating a query. JSONPath is a query language for extracting values from an existing document; it is a different tool from JSON Pointer (RFC 6901), which identifies a single, specific location in a document (like /store/book/0/title) rather than searching or matching. To check whether your JSON is syntactically valid first, use the JSON Formatter; to compare two JSON documents, use JSON Diff; to validate JSON against a schema, use the JSON Schema Validator.
What this tool does
Test a JSONPath expression against a JSON document.
JSONPath cheat sheet
All examples use this document. Paste it into the evaluator and try each expression.
{
"store": {
"book": [
{ "title": "A", "price": 8.95, "category": "reference" },
{ "title": "B", "price": 12.99, "category": "fiction", "isbn": "0-553-21311-3" },
{ "title": "C", "price": 22.99, "category": "fiction" }
],
"bicycle": { "color": "red", "price": 399 }
},
"first-name": "Ann"
}
| Expression | Returns | What it does |
|---|---|---|
$ |
the whole document | The root |
$.store.book[*].title |
"A", "B", "C" |
Wildcard over array items |
$..price |
all four prices | Recursive descent: every price at any depth |
$.store.book[0] |
first book | Index (zero-based) |
$.store.book[-1].title |
"C" |
Negative index counts from the end |
$.store.book[0:2].title |
"A", "B" |
Slice: start inclusive, end exclusive |
$.store.* |
the book array and the bicycle object | Wildcard over object members |
$['first-name'] |
"Ann" |
Bracket notation for keys with -, spaces or dots |
$.store.book[?@.isbn].title |
"B" |
Filter: items that have an isbn key |
$.store.book[?@.price < 10].title |
"A" |
Filter by comparison |
$.store.book[?@.category == 'fiction' && @.price > 20].title |
"C" |
Combine conditions with &&, ||, ! |
$.store.book[?match(@.category, 'fic.*')].title |
"B", "C" |
Regex, must match the whole value |
$.store.book[?search(@.category, 'ict')].title |
"B", "C" |
Regex, matches anywhere in the value |
$.store.book[?length(@.title) == 1].title |
"A", "B", "C" |
Built-in functions: length, count, match, search, value |
Every result in this table was produced by an RFC 9535 implementation, not copied from older docs.
Why your expression works elsewhere but not here
JSONPath existed for 17 years as an informal blog post before it was standardized as RFC 9535 in 2024. Libraries filled the gaps differently, so expressions that work in one tool often fail in another. The common ones:
$.first-name is a syntax error. Dot notation only accepts plain identifier characters. Use $['first-name'].
$.store.book.length returns nothing. There is no .length property in RFC 9535. Use the length() function inside a filter, or count the results.
Script expressions like [(@.length-1)] fail. The original JSONPath let implementations run arbitrary JavaScript inside (). RFC 9535 removed this (it was a security hole). Use [-1] for the last item.
Unquoted strings in filters fail. [?@.category == fiction] is an error. Strings need quotes: 'fiction' or "fiction".
Parentheses around filters are optional. [?(@.price < 10)] (classic style) and [?@.price < 10] (RFC style) are equivalent.
No match returns an empty list, not an error. $.missing gives zero results. If you expected a match, check the key spelling and case first.
Order of results from objects isn't guaranteed. For recursive descent (..) and wildcards over objects, the RFC doesn't fix the member order. Arrays keep their order.
If your expression will run in a specific library (Jayway in Java, jsonpath-ng in Python, JSONPath-Plus in JavaScript, PostgreSQL's jsonb_path_query), test it there too. Most of these predate the RFC and still differ at the edges.
Normalized paths
Next to each match, the evaluator shows its normalized path, like $['store']['book'][1]['price']. This is the canonical, unambiguous location of that value. It's handy for pointing to an exact value in a bug report, or for turning a broad .. query into a precise one once you know where the data lives.
FAQ
Is my JSON uploaded?
No. The expression is evaluated in your browser with JavaScript. Your JSON and the expression are never sent to Docspira. You can check the Network tab in your browser's developer tools.
What's the difference between JSONPath and JSON Pointer?
JSON Pointer (/store/book/0/title) points to exactly one value and has no wildcards or filters. JSONPath ($.store.book[*].title) is a query language that can return many values. JSON Schema error paths use JSON Pointer.
How do I filter by a value in a nested object?
Chain inside the filter: $.orders[?@.customer.country == 'BR'].
How do I select items where a field does not exist?
Negate the existence test: $.store.book[?!@.isbn].
Is JSONPath the same as jq?
No. jq is a full transformation language with its own syntax (.store.book[] | .title). JSONPath only selects values. If you need to reshape JSON, use jq; if you need to point at values (in config, tests, API gateways), JSONPath is the usual choice.
Before you start
JSONPath implementations differ at the edges, so validate the final expression in the application library that will run it.
Privacy
This tool runs in your browser; the text or file you choose is not uploaded for processing. Read the privacy details.