JSONPath Tester

Paste JSON on the left, set JSONPath in the footer of that column, then Query. Sample JSON and a path are prefilled.

About JSONPath queries

Paste JSON on the left, write a JSONPath in the path row, then click Query. Matches always come back as one JSON array in the results pane. Nothing runs while you type—only the button triggers a query.

Invalid JSON shows a line hint under the input. A bad path shows an error under the path field. An empty match set is still success: the array is [].

JSONPath — background

Paths and RFC 9535

JSONPath selects values inside parsed JSON. $ is the root. $.store.book[0].title reads one field; [*] walks every element; $..price finds a name at any depth. Filters such as [?@.price<10] keep rows that pass a test.

One array for every hit

The tool always returns a JSON array, even for a single match or for $. wrapping the whole document. Copy from the header icon or by clicking the formatted result.

Slices, unions, and functions

  1. Array slices like [0:2] and unions like [0,2] follow the standard grammar.
  2. Inside filters you can use length(), count(), match(), search(), and value().
  3. Unicode escapes in the source JSON stay escaped in output; literal characters stay literal.

What this page is not

It does not rewrite the document like JSON flatten. To click the tree and copy a path, use the JSONPath generator. To pretty-print first, use JSON formatter.

Typical use

Pull ids from an API response

Paste the body, run $.items[*].id, and copy the array into a script or ticket.

Check a filter before production

Try $.records[?@.status=="active"].email on sample JSON to see every email that would match.

Frequently asked questions

How do I query JSON with JSONPath online?
Paste JSON, enter a path such as $.store.book[*].title, and click Query. Every match appears in one JSON array.
How do I test a JSONPath expression?
Use the same steps: JSON on the left, expression in the path row, then Query. Editing the path alone does not re-run until you click again.
What does an empty JSONPath result [] mean?
The expression ran successfully but no nodes matched—[] is the correct output, not an error. Check key names, array indexes, wildcards, and filters against your JSON, or try $ or a shorter path to confirm the document parses as expected.
What if the JSON or path is invalid?
Invalid JSON shows under the input—trailing commas and comments need JSON repair & validate first. A path that breaks JSONPath syntax clears the result and shows an error under the path field.
How is this different from the JSONPath generator?
The generator builds a path by clicking nodes in a tree. This page runs an expression you already have against JSON.
How is JSONPath different from flatten?
JSONPath returns selected values without changing the original shape. JSON flatten rewrites nested objects into one layer of keys.