Test JSONPath without leaving your browser
JSONPath is a query language for pulling specific values out of a JSON document — the JSON equivalent of XPath for XML. Paste a document, type an expression, and instantly see which values it selects. It is useful for building API integrations, debugging config files, or learning how JSONPath traversal works.
How it works
The expression is evaluated left to right against your parsed JSON, starting from
the root $. Each segment narrows the set of matches, and the final values are
shown as a JSON array that updates as you type.
| Syntax | Meaning |
|---|---|
$ | the root document |
.key / ["key"] | a member by name |
[0] | an array element by index |
[-1] | last element (negative counts from the end) |
[*] | every element of an array or value of an object |
Recursive descent (..) and filter expressions are not included.
Example
Given this JSON:
{ "store": { "books": [
{ "title": "A", "price": 5 },
{ "title": "B", "price": 8 }
] } }
the expression $.store.books[*].title matches both titles and returns:
["A", "B"]
$.store.books[-1].price returns [8]. All evaluation runs client-side — your
JSON is never uploaded anywhere.
Where JSONPath is used in practice
JSONPath originated in a 2007 paper by Stefan Goessner and has since been standardised by RFC 9535 (2024). It appears in:
- API testing tools — Postman and similar tools use JSONPath in test assertions to extract and verify values from API responses.
- AWS Step Functions — the state machine language uses JSONPath to select fields from event inputs and pass them to subsequent steps.
- Kubernetes —
kubectluses JSONPath expressions in--jsonpathflags to extract specific fields from resource output, for example{.status.phase}to read a pod’s phase. - JSON Schema — the
$refmechanism is built on JSON Pointer (a close relative), and filter assertions in some implementations use JSONPath syntax. - Log aggregators — tools like Grafana Loki support JSONPath to extract fields from structured log lines for dashboards and alerts.
Common expressions you can try
| Expression | What it selects |
|---|---|
$ | the entire document |
$.name | the top-level name field |
$.users[0] | the first element of the users array |
$.users[-1] | the last element of the users array |
$.users[*].email | every email field in the users array |
$.["full name"] | a top-level key that has a space in it |
Debugging when nothing matches
If the result is an empty array, check these common causes:
- Typo in the key name. JSONPath keys are case-sensitive —
$.Nameand$.nameare different. - Wrong level. Use
$to start from the root and build the path one level at a time to find where you go wrong. - Bracket vs dot notation mismatch.
$.store.booksand$.store["books"]are equivalent — but$.["store"]["books"]is also valid. Try bracket notation for any key that has a hyphen or other special character. - Array not where you think. The wildcard
[*]only expands arrays. Ifbooksis an object, not an array,books[*]will not match its keys — usebooks.*instead.