Skip to content
Aarrange

JSONPath Tester

Paste JSON and type a JSONPath. See each match marked in the JSON, with its exact path, and each error in plain words. Nothing leaves your browser.

0
Matches
0
Steps
0
Errors
Input
Paste JSON below. Queries for it show here.Use jq
Tab types a tab. Press Escape, then Tab, to leave the editor.
Result
The result shows here as you type.Try , or .
On this page

About JSONPath Tester

Updated

JSONPath Tester runs a JSONPath query on your JSON and shows what it finds. It follows RFC 9535, the JSONPath standard from 2024. Each match gets a mark in the JSON, so you see where it is, and the Paths view gives the exact path of each one. A wrong query gets a ring on the exact spot and a fix.

Many online JSONPath tools run an older library. For some correct paths they show an empty result and no error. This tool runs both: when the old library gives another answer, the Summary says so. To see your JSON as a tree and copy the path of any value, use the JSON Viewer. For jq filters, use the jq Playground.

Not sure which tool to use? See the best JSON formatters compared.

How to use JSONPath Tester

  1. Paste your JSON in the editor, or drop a .json file on it.
  2. Type a JSONPath in the bar above the JSON, for example $.items[*].name. The chips under the bar give queries that fit your JSON.
  3. Read the result: Result has the values as JSON, Paths has the path of each match. Click a row in Paths to mark it in the JSON.
  4. Press Run (Alt R) or Enter to check now. The link icon at the end of the bar copies a share link.

JSONPath syntax

WriteTo get
$The whole JSON (the root)
.name or ['name']The value of a key. Use brackets for keys with dots, spaces or dashes
[0], [-1]The first item, the last item
[0:3]Items 0, 1 and 2 (a slice)
[*] or .*All items or all values
..nameEvery key called name, at any depth
[?@.price < 10]The items that pass a test; @ is the item
[?length(@.tags) > 2]A test with a function: length, count, match, search, value

Common errors

A filter with no closing bracket

The filter starts with [? and must end with ] before the next step. Many tools say "Unexpected ? at character 0". This one puts the ring where the bracket goes.

Invalid
$.store.book[?(@.price < 10).title

Tool:Add ] here. The [ at column 13 is never closed. With ] here, the path works.

Fixed
$.store.book[?(@.price < 10)].title

Old syntax from Jayway or Goessner

Script expressions in round brackets and functions after a dot come from older libraries. RFC 9535 has a shorter form for each.

Invalid
$.store.book[(@.length-1)].title

Tool:Write [-1]. Script expressions such as (@.length-1) are not in RFC 9535. A negative index counts from the end.

Fixed
$.store.book[-1].title

A single = in a filter

A filter compares with ==. A single = or a JavaScript === stops the path.

Invalid
$.users[?@.role = 'admin'].email

Tool:Write == to compare. A single = is not a comparison in JSONPath.

Fixed
$.users[?@.role == 'admin'].email

A bare key that finds too much

In RFC 9535, [?@.active] tests that the key exists. A user with "active": false has the key, so the filter keeps that user too. The Summary warns about this.

Finds false too
$.users[?@.active].name
Fixed
$.users[?@.active == true].name

JSONPath resources

  • RFC 9535: JSONPathThe JSONPath standard from the IETF, February 2024. The rules this tool runs.
  • JSONPath: XPath for JSONStefan Goessner's article from 2007 that started JSONPath, with the bookstore example.
  • JSONPath ComparisonHow more than 40 JSONPath libraries answer the same queries. It shows where they disagree.
  • Jayway JsonPathThe Java library behind many Spring and REST Assured tests, with its own functions and operators.
  • JSONPath in kubectlHow kubectl get -o jsonpath reads a path, with range and end.
  • jsonpath-rfc9535 on npmThe JavaScript library this page uses, written to the standard.

JSONPath FAQ

What is JSONPath?

A short language that picks values out of JSON, as XPath does for XML. $ is the whole document, .name goes into a key, [0] takes an item, [*] takes all, .. looks at every level, and [?...] keeps the items that pass a test.

$.store.book[?@.price < 10].title reads: from the root, into store, into book, keep the books with a price under 10, and take each title.

How do I test a JSONPath expression?

Paste your JSON in the editor and type the path in the bar above it. The result updates as you type. Each match gets a yellow mark in the JSON. Result shows the values as a JSON list, Paths shows the exact path of each match.

No JSON at hand? Open Example and pick one: an API response, a Kubernetes pod list or GitHub issues.

Why does my JSONPath return nothing?

Four causes cover most cases. A key with a dot, a space or a dash needs brackets: $['user-name'], not $.user-name. Keys are case-sensitive: $.Name does not find name. A path to a list item needs the list step: $.items[*].id, not $.items.id. And some tools run an older dialect.

jsonpath.com, JSONLint and many Node.js projects use the jsonpath-plus library. It gives an empty result, with no error, for standard paths such as [?@.isbn], length() and keys with quotes. This page runs the standard, and says when jsonpath-plus would answer differently.

What is RFC 9535?

The JSONPath standard, published by the IETF in February 2024. Before it, each library had its own rules, and the same path could give different results. RFC 9535 fixes the syntax, the filter rules and five functions: length(), count(), match(), search() and value().

Libraries move to it one by one. Check which rules yours runs before you copy a path from here.

How do I filter by a value in JSONPath?

Write a filter in brackets with ?, and @ for the item being tested: $.users[?@.age >= 18]. Join tests with && (and) and || (or). Compare text in single or double quotes: [?@.role == 'admin']. For a pattern, use match(@.email, '.*@example\.com').

Careful with a bare key: [?@.active] keeps every item that has the key active, also when it is false. Write [?@.active == true] to test the value.

What is the difference between JSONPath and jq?

JSONPath only selects: it gives back values that are in the JSON. jq is a small programming language: it selects, and it also builds new objects, counts, sorts and turns JSON into CSV. Tools and libraries (kubectl, Postman, Jayway, AWS Step Functions) take JSONPath. On a command line, jq is the usual choice.

To try a jq filter on the same JSON, use the jq Playground.

Is my JSON uploaded?

No. The query runs in your browser, in JavaScript. Nothing is sent to a server, and the page works offline once it has loaded. A share link keeps the data after the # of the address, and a browser never sends that part to a server.