JSONPath Tester

Test JSONPath expressions against your JSON, see the matched values and the exact paths of the matches, and load an example to learn the syntax.

About JSONPath Tester

The JSONPath Tester runs a JSONPath expression against your JSON and shows the matching values and their exact paths. Load the example to learn the syntax fast.

The basics

$ is the root, a dot or brackets pick a child, .. searches every level, * means every child, [0] picks by index and [?(@.price<10)] filters.

Examples

$..price finds every price at any depth. $.store.book[?(@.price<10)].title returns the titles of the cheap books.

Empty is not an error

If nothing matches, you get an empty list.

Good for

Reading API responses, writing checks against JSON output, and pulling fields from exports.

Private

Everything runs in your browser. Nothing you paste is uploaded.

How to use JSONPath Tester

  1. Paste your JSON document into the JSON box, or press Load example.
  2. Type a JSONPath expression into the expression box.
  3. Press Run.
  4. Read the matched values and the paths of the matches, then adjust the expression and run again.

Related guide: How to Format and Validate JSON (With Common Errors Explained)

Help & FAQ

What is JSONPath?

It is a query language for JSON, similar to XPath for XML. An expression such as $.store.book[0].title selects values from a JSON document.

What does the $ sign mean?

It stands for the root of the document. Most expressions start with it.

What is the difference between a dot and a double dot?

A single dot selects a direct child. A double dot, as in $..price, searches every level below the current point.

How do we filter items?

Use [?( ... )] with @ for the current item, for example $.store.book[?(@.price<10)].title.

How do we select several array items?

Use a comma list such as [0,1] or a slice such as [0:2]. A negative index such as [-1:] picks from the end.

Why do we get an empty result?

Nothing matched. Check the spelling and case of the field names, and that the path really exists in your JSON.

What is the second output box?

It shows the exact path of every match, for example $['store']['book'][0]['title'], so you can see where each value came from.

Will our expression work in our own code?

Often, but JSONPath libraries differ in syntax details, such as filters and length. Test it in the library you will use.

Why does .length return a value?

In the test, $.store.book.length returned 3. Some implementations support it and others do not, so do not depend on it without checking.

Is our JSON uploaded?

No. It is processed in your browser. In a test, only small analytics calls were made.

What if our JSON is invalid?

Fix it first. The JSON Validator or the JSON Formatter can point to the problem.

Can we test XML or YAML?

No. This tool works on JSON. Convert other formats to JSON first, for example with the XML to JSON tool.

More in Developer Tools

See all 39 in Developer Tools