Guide: JSONPath Tester
↑ Back to toolWhat is this tool?
This JSONPath tester evaluates a JSONPath expression against JSON you paste and shows every match instantly. JSONPath is to JSON what XPath is to XML: a compact query language for selecting values from deeply nested documents, such as $.store.book[*].author. The evaluator runs entirely in your browser with no upload and no sign-up.
It supports child access, array indexes and slices, wildcards, recursive descent (..), unions, and filter expressions with comparisons, boolean logic, regular expressions, and helper functions. Results can be shown as values, as normalized paths, or both.
💡 Quick tip
Click a sample path chip to try a pattern, then edit it. Switch the output to Paths to see exactly where each match lives, for example $['store']['book'][0]['title'].
Why use an online JSONPath tester?
Writing a path blind and running your whole app to check it is slow. A JSONPath evaluator online gives you a tight feedback loop: paste a real payload, adjust the expression, and see the result live.
- Prototype paths for API assertions, log queries, and config extraction before putting them in code.
- Debug why a path returns nothing: bad key, wrong index, or a filter that never matches.
- Learn the syntax by experimenting with built-in samples.
- Extract just the fields you need from huge responses.
Key features
- Live evaluation — Results update as you type the path or the JSON.
- Full selector set — Names, indexes, negative indexes, wildcards, slices with steps, unions, and recursive descent.
- Filters —
==,!=,<,<=,>,>=,&&,||,!, grouping, existence tests, and=~ /regex/. - Functions —
length(),count(),match(),search(), andvalue(). - Output modes — Values, normalized paths, or both as pretty-printed JSON.
- Helpful errors — Parse errors show the problem and the position in your expression.
- History & session memory — Copy a result to save the query in History; inputs persist in this tab.
How to use
- Paste JSON — Drop your document into the JSON input, or press Sample.
- Enter a path — Start with
$and build the expression, or click a sample chip. - Read the result — Matches appear on the right with a count. Toggle Values, Paths, or Both.
- Copy — Copy the output; the query is also saved to History so you can reload it later.
JSONPath syntax reference
| Syntax | Meaning |
|---|---|
| $ | Root of the document |
| @ | Current node inside a filter |
| .key or ['key'] | Child property by name (use brackets for spaces or special characters) |
| [n] / [-n] | Array element by index; negative counts from the end |
| [*] / .* | Wildcard: every element of an array or every value of an object |
| ..key / ..* | Recursive descent: search the node and all of its descendants |
| ['a','b'] / [0,2] | Union: several names or indexes at once |
| [start:end:step] | Array slice, e.g. [0:2], [-2:], [::2], [::-1] |
| [?(expr)] | Filter: keep children for which the expression is true |
Filter expressions
A filter [?(…)] tests each child of an array or object. Inside the filter, @ refers to the child being tested and $ still refers to the document root.
- Comparisons —
@.price < 10,@.category == 'fiction'. Numbers compare with numbers and strings with strings; mismatched types are simply false. - Existence —
[?(@.isbn)]keeps items that have the key, and[?(!@.isbn)]keeps those that do not. - Logic — Combine with
&&and||, negate with!, and group with parentheses. - Regex —
@.name =~ /^ab/itests a string against a JavaScript regular expression. - Functions —
length(@.tags) > 2,count(@.*) == 4,match(@.id, 'a.*')(whole string),search(@.id, 'x')(anywhere). - Cross-references — Compare to another part of the document:
[?(@.price < $.expensive)].
Examples
These all run against the built-in sample (a small bookstore document):
| Path | Result |
|---|---|
| $.store.book[*].title | Titles of every book |
| $.store.book[-1] | The last book |
| $..price | Every price anywhere in the document |
| $.store.book[?(@.price < 10)].title | Titles of books cheaper than 10 |
| $..book[?(@.isbn)] | Books that have an isbn key |
| $.store.book[?(@.category == 'fiction' && @.price < 10)] | Cheap fiction |
| $..book[?(@.author =~ /^J\./)].author | Authors starting with “J.” (regex) |
| $.store.book[0:2] | First two books |
| $.store['book','bicycle'] | Union of two child properties |
Use cases
| Scenario | How this tool helps |
|---|---|
| API testing | Design JSONPath assertions for Postman, REST Assured, Karate, or k6 against a real response. |
| Kubernetes & CLI output | Prototype extraction paths for kubectl -o jsonpath style queries. |
| Data pipelines | Pick fields from nested events for ETL tools, Logstash, or workflow engines. |
| Log & payload analysis | Filter large JSON logs down to the entries you care about. |
| Learning | Experiment with syntax and see matched paths side by side. |
Best practices
- Be specific — Prefer
$.store.book[*].priceover$..pricewhen you know the structure; recursive descent can match unexpected keys. - Quote awkward keys — Use
$['first name']or$['a.b']for spaces, dots, and unusual characters. - Treat results as lists — A path always yields a list, even for one match. Handle empty results explicitly in code.
- Check your library — Implementations differ on filters, regex flavor, and edge cases. Test the final path in the library you ship with.
- Format first — Pretty-print messy input with the JSON Formatter to understand the structure before writing a path.
Common mistakes
- Double quotes vs single quotes — Both work inside brackets; use whichever avoids escaping inside your host language string.
- Forgetting the wildcard —
$.store.book.titlereturns nothing becausebookis an array; use$.store.book[*].title. - Filters on the wrong level —
[?(…)]tests the children of the node before it, so place it after the array or object you want to filter. - Comparing different types —
@.price == '8.95'never matches the number 8.95. - Index out of range — Missing indexes return no match rather than an error.
FAQ
What is JSONPath?
JSONPath is a query language for selecting parts of a JSON document. It was introduced by Stefan Goessner and standardized as RFC 9535. A path like $.store.book[0].title walks the document from the root to the value you want.
Is this JSONPath tester free and private?
Yes. Evaluation happens in your browser; your JSON and expressions are not sent to a server.
What does $.. mean?
Two dots are recursive descent: $..price finds every key named price at any depth.
How do I filter an array?
Use a filter selector such as $.items[?(@.qty > 1)]. Inside the parentheses, @ is the element being tested.
Why is my result empty?
Common causes: a typo in a key, a missing wildcard on an array, a filter comparing different types, or JSON that differs from what you expect. Switch the output to Paths and try a shorter expression to find where it stops matching.
Does it support regular expressions?
Yes. Use @.field =~ /pattern/flags, or the match() and search() functions with a string pattern.
How is this different from jq?
jq is a full command-line language with transformations; JSONPath is a lighter selection syntax embedded in many tools and libraries. Use JSONPath for selecting values and jq for reshaping.
Can I get the location of each match?
Yes. Switch the output mode to Paths or Both to see normalized paths like $['store']['book'][0]['title'].
Related terms
Core: jsonpath tester, jsonpath evaluator online, jsonpath online, test jsonpath expression, jsonpath query, jsonpath filter, jsonpath cheat sheet.
Syntax: recursive descent, array slice, wildcard, filter expression, RFC 9535, normalized path, jsonpath regex.
Ecosystem: jayway jsonpath, jsonpath-plus, Postman jsonpath, kubectl jsonpath, jq vs jsonpath, json query language.
Similar tools
You might also find these developer tools useful:
Conclusion
This JSONPath tester gives you instant feedback while you build queries: wildcards, slices, recursive descent, and rich filters, with values or normalized paths in the output. When you are done extracting, generate types with JSON → Types, compare documents with the JSON Diff, or tidy input with the JSON Formatter.