Skip to content
PocketDesk
Your files are processed on your device, never uploaded

JSONPath query

  • On device
Input
Ln 1, Col 11 line0 BUTF-8

Paste, drop or open a file in Input to see the result here.

Waiting for input
  • ⌘Enter Format
  • ⌘⇧M Minify
  • ⌘⇧C Copy result
  • ⌘F Find in result
  • Esc Exit full screen
  • Use Ctrl instead of ⌘ on Windows and Linux

How to query JSON with JSONPath

  1. Paste your JSON into Input, drop a .json file on the page, or press Open file.
  2. Type a query in the JSONPath query box. It starts with $, which means the whole document.
  3. The matches appear as you type, as a JSON array. Select Copy to take them with you.

If the query has a mistake, the message says where in the query it went wrong. If the JSON itself is broken, you get the line and column.

JSONPath cheat sheet

  • $.store.name gets a child by name.
  • $['first name'] gets a child whose name has spaces or symbols.
  • $.items[0] and $.items[-1] get the first and last item.
  • $.items[1:3] is a slice, $.items[::2] takes every second item.
  • $.items[*].name uses a wildcard to take every item.
  • $..price searches at any depth for a key called price.
  • $.items[?(@.price > 10)] keeps items that pass a test. Inside a filter, @ is the item being checked.
  • $.items[?(@.tags.length > 1 && @.stock)] combines tests with &&, || and !.

Where this helps

JSONPath is a fast way to pull one value out of a big response while debugging an API, to write a test assertion, or to configure tools that accept JSONPath expressions. Try the query here first, then copy it into your code.

Tips

  • Not sure of the structure? Open the document in the JSON tree viewer and click a row to copy its path.
  • Turn on Show paths to see exactly which node each match came from.
  • Results are limited to 10,000 matches to keep the page quick.
  • The result can be turned into a table with JSON to CSV.

Privacy

Your documents and queries stay in your browser. Nothing is uploaded, stored or logged.

Questions

Which JSONPath syntax is supported?

The root $, dot and bracket names, array indexes including negative ones, slices like [1:3], the * wildcard, .. recursive search, unions like [0,2], and filters such as [?(@.price > 10)].

Can filters run any JavaScript?

No. Filters use a small, safe expression reader that handles comparisons, && and || and !, with no eval or code execution.

Why do I get an empty array?

Nothing matched. Check key spelling, remember that names are case sensitive, and try $..name to search at any depth.

Can I see where each match came from?

Yes. Turn on Show paths to get each match as an object with its path and value.

Is my JSON uploaded?

No. Queries run in your browser and your data never leaves your device.

More developer tools