What this evaluates
JSONPath queries against any JSON document. Type your JSON, type the query, see what matches. The result panel shows every value the query selects, formatted as a JSON array.
JSONPath is to JSON what XPath is to XML, a query language for picking out specific values from nested structures. Used widely in API testing, configuration filtering, and data transformation pipelines.
Supported syntax
This implementation covers the most common JSONPath constructs:
$, the root of the document.key, child access ($.storeselects the value of “store”)..key, recursive descent ($..pricefinds every “price” key at any depth)[n], array index ($.books[0]is the first book)[*], all array elements ($.books[*]returns every book).*, all values of an object ($.store.*returns all top-level values in store)
Combine these freely: $.store.books[*].title returns the title of every book.
What’s NOT supported (yet): filter expressions like [?(@.price < 10)], slice notation like [1:3], or function syntax. For full JSONPath compliance you’d want a complete library like jsonpath-plus. This tool covers the cases that come up in 90% of practical work.
Common queries you’ll use
For an API response, real workflows look like:
// Get every user's email
$.users[*].email
// Find all numeric IDs anywhere in the response
$..id
// First 3 items would normally need slice, fall back to [0], [1], [2]
$.results[0]
$.results[1]
$.results[2]
// All values at top level (when you don't know the keys)
$.*
Why JSONPath matters
Three real use cases:
-
API integration: a webhook returns deeply nested JSON. You want to extract just the timestamps or just the user IDs. JSONPath lets you specify exactly that without writing custom traversal code.
-
Test assertions: API testing tools like Postman and Karate use JSONPath in their assertion language.
$.data.user.emailshould equal"[email protected]". Knowing JSONPath = knowing how to write tighter test assertions. -
Configuration: tools like Helm, Argo, and Kubernetes manifests use JSONPath-like expressions to template values. Learning JSONPath transfers across many infra tools.
Differences from jq
jq is a similar tool with a different (more powerful, less standardized) syntax. JSONPath is more widely supported in libraries; jq is more expressive in the shell.
Quick translation:
- JSONPath
$.store.books[*].title≈ jq.store.books[].title - JSONPath
$..price≈ jq..|.price? - JSONPath
$.users[0]≈ jq.users[0]
If you’ve used jq, JSONPath will feel familiar. If you’ve used XPath (XML), the analogy is even closer, recursive descent and wildcards work nearly identically.
Frequently asked questions
Why doesn’t my filter expression work?
This implementation doesn’t support filter expressions ([?(@.x > 5)]). For filter syntax, use a full JSONPath library or the official jsonpath-plus npm package.
The result is empty but I expect matches, what’s wrong?
Double-check the path. Common mistakes: missing the $ prefix, mixing dot and bracket access incorrectly (use .foo not ["foo"]), using [] for objects instead of arrays.
Why are some matches duplicated?
Recursive descent (..) finds every match regardless of depth. If a key appears at multiple nesting levels, all of them are returned. The duplicates are real, they come from the input data structure.
Can I save queries? Not currently. The query lives in the textarea only. For repeated use, paste your JSON and bookmark complex queries in a notes file.