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,.nameand['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 functionslength(),count(),match(),search()andvalue().
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:
$..authorreturns all four authors, from$['store']['book'][0]['author']to$['store']['book'][3]['author'].$..book[?@.price < 10].titlereturns "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].titlereturns 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..nameor['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 uselength(),count(),match(),search()andvalue().
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.