JSON

JSONPath Tester

Write a JSONPath query and see every matching value and its normalized path. Supports wildcards, recursive descent, slices, unions and filters with functions.

Guide: JSONPath Cheat Sheet: Query JSON With RFC 9535

Ready.

What it does

JSONPath is a query language for picking values out of JSON, like XPath for XML. It is standardised as RFC 9535. Enter a query and the tool lists every matching value together with its normalized path, such as $['store']['book'][0].

Supported syntax

  • $ root, .name and ['name'] children, * wildcard, .. recursive descent.
  • Indexes [0], [-1], slices [1:5:2] and unions [0,2,'a'].
  • Filters [?@.price < 10 && @.isbn] with == != < <= > >=, && || !, parentheses, absolute queries ($.limit) and the functions length(), count(), match(), search() and value().

Limits

This tool implements the core of RFC 9535 and follows its rules for slices, comparisons and missing values, but it is not a certified implementation: uncommon corners such as I-Regexp restrictions and some whitespace rules are handled loosely. Numbers are read by your browser's JSON parser.

Examples on the sample bookstore

The tool starts with the classic bookstore document, which has four books and a bicycle. These are real results for common queries, each with the normalized path of every match:

  • $..author returns all four authors, from $['store']['book'][0]['author'] to $['store']['book'][3]['author'].
  • $..book[?@.price < 10].title returns "Sayings of the Century" and "Moby Dick", the two books that cost less than 10.
  • $..book[-1] returns the last book, "The Lord of the Rings", at $['store']['book'][3].
  • $..book[?@.isbn].title returns the books that have an ISBN field at all: "Moby Dick" and "The Lord of the Rings".

Syntax in one minute

  • $ is the root and @ is the current item inside a filter.
  • .name or ['name'] selects a child, * selects every child and .. searches at any depth.
  • [0] and [-1] select by index (negative counts from the end), [1:3] is a slice and [0,2] is a union.
  • [?@.price < 10] keeps the items for which the condition is true. You can combine conditions with &&, || and !, and use length(), count(), match(), search() and value().

JSONPath had no official standard for many years, so tools written before RFC 9535 differ in corner cases such as slices, filters and missing values. This tester follows the RFC. To explore a document without writing a query, use the JSON Tree Viewer, which shows the path of every value.

Frequently asked questions

What is the difference between values and paths in the result?

Values are what the query found. Paths tell you where each value lives in the document, written in the normalized form with brackets and quotes.

Is this the same as jq?

No. jq is a different query language for the command line. JSONPath selects values by path, and jq can also transform them.

Is my JSON uploaded?

No. Queries run in your browser.

Privacy

This tool runs entirely in your browser. What you enter is processed on your device and is not sent to a server.

Share this tool

Your data is not included in this link.