Developer ToolsCode ValidatorsFree Tool

JSONPath Tester

Test JSONPath expressions against your JSON data in your browser. See the matching values and the path of each match. Supports property access, array indexes and slices, wildcards, recursive descent and simple filters.

Runs entirely in your browser.

How to Use JSONPath Tester
  1. 1Paste your JSON into the data box (a sample is loaded)
  2. 2Type a JSONPath expression starting with $
  3. 3Click Run query to see the matching values
  4. 4Open the match paths to see exactly where each value was found
About JSONPath Tester

What this tool does

JSONPath is a query language for picking values out of a JSON document, a bit like XPath for XML. Paste JSON, type an expression that starts with $, and the tool shows the matching values and the path to each match. It runs in your browser and nothing is sent anywhere.

Try it: the sample data

The tool loads a small bookstore document with three books and a bicycle. These are real results from it:

ExpressionResult
$.store.book[*].author"Nigel Rees", "Evelyn Waugh", "Herman Melville"
$..price8.95, 12.99, 8.99, 19.95 (every price anywhere)
$.store.book[-1:].title"Moby Dick" (the last book)
$.store.book[:2].author"Nigel Rees", "Evelyn Waugh" (first two)
$.store.book[0,2].price8.95, 8.99 (first and third)
$.store.book[?(@.price < 10)].title"Sayings of the Century", "Moby Dick"
$..book[?(@.isbn)].title"Moby Dick" (only books that have an isbn)
$.store.book[?(@.category == 'fiction' && @.price > 10)].title"Sword of Honour"

Supported syntax

  • $ the root; .key or ['key'] for properties; [0] and [-1] for array items.
  • * or [*] for every child; .. to search at any depth.
  • Slices [start:end] and unions [0,2] or ['a','b'].
  • Filters [?(@.field)] for existence and comparisons with ==, !=, <, <=, >, >=, joined with && and ||.

Limits

  • Script expressions, regular-expression matching and parentheses inside filters are not supported. JSONPath libraries differ in how they handle these, so a query that works in one library may behave differently in another.
  • No match gives an empty result, not an error. If you expect a match, check the spelling and capitalisation of property names, which are case-sensitive.
  • Comparisons only work between values of the same type, so a number is never compared with a string.
  • Invalid JSON is reported with the parser's message before the query runs.

If your JSON is hard to read, tidy it with the JSON formatter first, or shrink it with the JSON minifier.

Frequently Asked Questions

The root $, .key and ['key'], array indexes (including negative), [*] and .*, recursive descent (..), slices like [0:2], unions like [0,1], and filters such as [?(@.price < 10)] or [?(@.isbn)] with ==, !=, <, <=, >, >=, && and ||.

Script expressions, regular-expression matching (=~), parentheses inside filters and other library-specific extensions. Behaviour for these differs between JSONPath libraries anyway.

Check that the path starts with $ and that key names and cases match your data exactly. Property names are case-sensitive.

No. The query runs entirely in your browser.

Related Articles

More from Developer Tools