JSONPath Tester
Test a JSONPath expression against a JSON document and see every match with its full path, such as $.users[2].name. Supports $, .name, ['name'], *, .., indexes, slices, unions and filters like [?(@.age > 28)]. Filters are parsed, never executed as code, and the evaluation runs in your browser.
How to use the JSONPath Tester
- Paste a JSON document, or press Load example for a small list of three users (Alice 30, Bob 25, Carol 35).
- Type an expression starting with
$, the root of the document. - Press Evaluate. The result shows how many nodes matched, each match's path and its value (the first 200 matches are listed).
With the example loaded, $.users[*].name returns "Alice", "Bob" and "Carol". The example expression $.users[?(@.age > 28)].name keeps only users older than 28 and returns "Alice" at $.users[0].name and "Carol" at $.users[2].name.
The path column is the quickest way to turn a match into code: $.users[2].name is data.users[2].name in JavaScript. Keys that are not plain identifiers are shown in bracket form, for example $['first name'].
Supported JSONPath syntax
JSONPath selects parts of a JSON document the way XPath selects parts of XML. The syntax was described by Stefan Goessner in 2007 and standardized as RFC 9535 in 2024; older libraries still differ in the details, so check what your own library supports. This tester implements the commonly shared subset:
| Expression | Selects | Example result |
|---|---|---|
$.users[0].name | A member, then an array element | "Alice" |
$.users[-1].name | Negative index: counts from the end | "Carol" at $.users[2].name |
$.users[*].name or $.users.*.name | Every element (or every member of an object) | Alice, Bob, Carol |
$..name | Recursive descent: name at any depth | Alice, Bob, Carol |
$.users[0:2].name | Slice: start included, end excluded | Alice, Bob |
$.users[-2:].name | Slice from the second-to-last element | Bob, Carol |
$.users[0,2].name | Union of indexes (or of quoted names) | Alice, Carol |
$['total'] | Bracket notation for a member | 3 |
$.users[?(@.role == 'admin')].name | Filter: elements whose condition is true | Alice |
Inside a filter, @ is the element being tested. Conditions compare an @ path with a number, a quoted string, true, false or null using ==, !=, <, <=, > and >=, and can be combined with &&, || and parentheses. For example, $.users[?(@.age >= 30 && @.role == 'user')].name returns only "Carol", and $.users[?(@.age < 26 || @.role == 'admin')].name returns "Alice" and "Bob".
Common use cases
- Writing API assertions. Tools such as JMeter's JSON Extractor and Karate accept JSONPath expressions. Try the expression here against a saved response before putting it in a test.
- Configuring extractors. Log shippers, monitoring checks and low-code automation tools often take a JSONPath to pull one value out of a payload. The path column shows exactly which node you are pointing at.
- Exploring an unfamiliar payload.
$..*lists every node with its path, and$..idfinds everyidat any depth. - Checking a filter before running it at scale. Filters behave differently from JavaScript comparisons (see below), so confirm which elements match on a sample first.
How filters compare values
- No type coercion.
@.id == '1'does not match anidof1; the number and the string are different values.==and===behave the same here. - Missing keys. A comparison with a key the element does not have is false, so
[?(@.tag != 1)]keeps elements that have notagat all. - Existence.
[?(@.tag)]keeps elements that have the key, whatever its value, includingnullandfalse. - Ordering.
<,<=,>and>=only compare two numbers or two strings; anything else is false. - Objects and arrays are equal when their contents are equal.
Not supported: slice steps ([0:10:2]), negation with !, function extensions such as length() or match(), and script expressions. Unsupported syntax produces an error message rather than a silent empty result.
Frequently asked questions
Why does my filter match nothing when the value is clearly there?
@.id == '1' compares a string with the number 1 and is false. Remove the quotes to compare numbers.How do I select a key that contains a space or a dot?
$['first name'] or $['a.b']. Such keys are also shown in this form in the path column.Does a filter run my expression as JavaScript?
[?(alert(1))] is rejected as a syntax error instead of being run.