Format Code Now
/

JSONPath Tester

FV-21

Put a JSONPath on the first line as -- path: followed by the expression, paste the JSON below it, and press Run to see every match. It runs in your browser.

Runs in your browser. Nothing is uploaded.

First line "-- path: $...", then the JSON

Matches

How to use it

  1. Start the input with a line such as -- path: $.store.book[*].author.
  2. Paste the JSON on the lines below it.
  3. Press Run for the matching values as a JSON array, or Show paths to see where each match sits.
  4. Edit the path and run again until the matches are the ones you want.

The supported subset

This tests a defined subset of JSONPath, with RFC 9535 behavior for what it supports. Supported: $ for the root, .name and ["name"], [n] with negative indexes, * and [*], recursive descent (..name, ..*, ..[...]), slices [start:end:step], unions such as [0,2], and filters [?(...)] with @ paths of names, indexes and *. Filters accept ==, !=, <, >, <=, >=, && and ||, parentheses, and numbers, quoted strings, true, false and null. A bare @.field tests that the key exists.

What is not supported

Functions such as length() and match(), regular expressions with =~, the ! operator, $ inside a filter, and a filter inside a filter are not supported, and the tester says so in an error instead of guessing. Other tools may accept more, or give a different result for an edge case such as a missing key, so confirm a path in the library you will use in production.

How comparisons behave

Numbers are compared by exact value, so 12345678901234567890 does not equal 12345678901234567891. The < and > operators work only between two numbers or two strings and give false for anything else. When a path in a comparison finds nothing, == is false and != is true. Descendants are listed parent first, and a key repeated in one object counts as its last value.

Error messages and what to do

MessageWhat it meansFix
Start the input with a line like "-- path: $.store.book[*].author", then put the JSON below it.The first line is not a path line, so the tester has no expression to run.Add a first line that starts with -- path: and holds your JSONPath.
JSONPath: A JSONPath must start with $ (character 1 of the path)The expression does not begin with the root symbol.Start it with $, for example $.store.book.
JSONPath: Negation with ! is not supported; use != or a comparison (character 6 of the path)The filter uses the ! operator, which this subset does not include.Rewrite the test with != or a comparison, such as @.price != 8.95.

Questions people ask

How do I test a JSONPath expression online?

Write -- path: and your expression on the first line, paste the JSON below it, and press Run. The matches appear as a JSON array. Press Show paths to list each match with its normalized path.

What does $..author return?

It returns every value named author at any depth, starting from the root. The two dots mean recursive descent: the tester looks at each node and all of its children, and parents come before their children in the results.

How do I filter by a value?

Use a filter such as $.store.book[?(@.price < 10)]. The @ stands for each book in turn. Combine tests with && and ||, and use [?(@.isbn)] to keep only items that have an isbn key.

Why do I get an empty array?

An empty array means the path is valid but nothing matched. Check the key spelling, that you used an index only on arrays and a name only on objects, and that a filter compares like types, such as a number with a number.

Does a slice like [1:3] include the end index?

No. A slice starts at the first index and stops before the second, so [1:3] returns items 1 and 2. A negative number counts from the end, and [::2] takes every second item.

Is this the same as every JSONPath library?

No. JSONPath implementations differ on edge cases and extensions. This tester follows RFC 9535 for the subset it lists, and rejects the rest, so use it to check the basic shape of a path and test the final one in your own library.

About this tool

Put the expression on the first line as -- path: followed by the path, then the JSON below it. Run returns the matches as a JSON array; Show paths lists each match with its normalized path. This is a tested subset, not full JSONPath. Supported: $ for the root; .name and ["name"] (single or double quotes); [n] with negative indexes; * and [*]; recursive descent with ..name, ..* and ..[...]; slices [start:end:step]; unions such as [0,2] or ["a","b"]; and filters [?(...)] (the parentheses are optional) built from @ paths made of names, indexes and *, the comparisons ==, !=, <, >, <= and >=, the operators && and ||, grouping with parentheses, and the literals numbers, quoted strings, true, false and null. A bare @.field tests that the key exists. Not supported, and reported as an error: functions such as length() or match(), regular expressions (=~), the ! operator, $ inside a filter, and filters nested in filters. Comparisons follow RFC 9535: < and > work only between two numbers or two strings, a missing key makes == false and != true, and numbers are compared exactly, so large integers are not rounded. Descendants are listed parent first, a repeated key in one object counts as its last value, and a dot name may contain letters, digits, _, $, - and non-ASCII characters.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.