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

  1. Paste a JSON document, or press Load example for a small list of three users (Alice 30, Bob 25, Carol 35).
  2. Type an expression starting with $, the root of the document.
  3. 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:

ExpressionSelectsExample result
$.users[0].nameA member, then an array element"Alice"
$.users[-1].nameNegative index: counts from the end"Carol" at $.users[2].name
$.users[*].name or $.users.*.nameEvery element (or every member of an object)Alice, Bob, Carol
$..nameRecursive descent: name at any depthAlice, Bob, Carol
$.users[0:2].nameSlice: start included, end excludedAlice, Bob
$.users[-2:].nameSlice from the second-to-last elementBob, Carol
$.users[0,2].nameUnion of indexes (or of quoted names)Alice, Carol
$['total']Bracket notation for a member3
$.users[?(@.role == 'admin')].nameFilter: elements whose condition is trueAlice

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 $..id finds every id at 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 an id of 1; 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 no tag at all.
  • Existence. [?(@.tag)] keeps elements that have the key, whatever its value, including null and false.
  • 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?

The most common cause is a type mismatch: @.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?

Use bracket notation with quotes: $['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?

No. The filter is parsed into comparisons and evaluated by the tester itself, so an expression like [?(alert(1))] is rejected as a syntax error instead of being run.

Is my JSON sent anywhere?

No. Parsing and evaluation run in your browser; the page makes no request with your input.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: