JSONPath Tester and Evaluator

Pull the fields you need out of deeply nested JSON with one expression and watch the matches update as you type, instead of writing a throwaway extraction script.

Writing a small script just to pull a few fields out of a nested response costs more time than the extraction itself — setting up the project is the expensive part. JSONPath describes the path in a single line: $.data.list[*].id returns every element identifier, $..price finds price at any depth, and filter expressions select by value. The expression is evaluated as you type, so the path is refined interactively rather than through repeated script runs.

Evaluation is performed by a front-end JSONPath library running in the browser. The pasted document is not sent to a server and leaves no request record anywhere, which is what makes the tool usable on payloads with internal fields, order line items or user identifiers. It also works with the network disconnected.

Writing the common expressions

$ denotes the root. $.user selects the user field directly under it, $.list[0] the first element of an array, and $.list[*] or $.list[:] every element. $..name is a recursive descent that ignores intermediate levels and collects every name it finds. Filters are written as $..items[?(@.price > 100)], where @ stands for the element currently under test, with comparison operators and logical combinations supported. The two wildcards are easy to confuse: $.* selects every member of the object at the root, while $..* collects every value in the entire document, in document order, which is useful for a quick inventory but rarely what you want as a final query. Union syntax pulls several keys in one expression, for example $.data["id","name"], and a key containing a dot or a space has to use bracket notation with quotes, as in $["my.key"].

The shape of the result

The return value is always an array of matches. Even a single hit comes back as an array of length one, and no match at all is an empty array [] rather than an error. Results are displayed with two-space indentation in a read-only editor below the expression field, and the array length is the hit count, so an over-broad expression is obvious at a glance. Copy takes the whole array text, which means pasting it into code still requires one parse on the other side. To get a single scalar instead, append an index to the expression, for example $..items[?(@.price > 100)][0].id.

Typical errors and how to debug them

When the expression is malformed, an error appears at the top and the result area stays empty. A few traps account for most of the confusion. $..[0] takes the first element of every array at every level, not the first element of the first array, so it typically matches far more than intended. String values inside a filter must be quoted: @.status == "paid". Compared types have to agree, so testing a numeric field against a quoted string in a filter will not produce results even when the value looks right. And the expression is evaluated against the parsed document, so a syntax error in the JSON itself also yields an empty result with no separate explanation.

Advertisement

Frequently asked questions

Does no match mean the expression is wrong?
Not necessarily. An empty array [] means the expression is valid but matched no nodes, which usually comes down to a misspelled field name, a wrong level in the path, or a filter value that genuinely is not present. Only an error message at the top indicates a syntax problem. When the nesting level is unclear, start with $.. to locate the field by name and then write the precise path.
What is the difference between $..[0] and $.list[0]?
$.list[0] is a definite path: it selects the first element of the list array under the root and matches at most one node. $..[0] is a recursive wildcard, so it finds every array at every depth and takes the first element of each — ten arrays in the document means ten results. To express "the first element of the first array", you have to write the definite path.
Are filters and regular expressions supported?
Filter expressions are supported, written as [?(@.field operator value)], where @ refers to the current element, string values need quotes, and multiple conditions can be combined with logical operators. The evaluator follows the front-end jsonpath-plus library, which implements some capabilities beyond the original specification. Backend implementations differ between languages, so verify an expression against the actual engine before depending on it in production.
Does querying modify my JSON?
No. Evaluation is a read-only operation: the document is parsed and read, never rewritten, and the result pane is read-only as well. To change the data, copy the result and take it to the formatter or the minifier — those are the operations that rewrite editor content, and they are deliberately separate from querying.

Related tools

Advertisement