JSON Query

Extract values from JSON with JSONPath expressions or RFC 6901 JSON Pointer

JSON

Query

JSON Query

Extract values from JSON with JSONPath expressions or RFC 6901 JSON Pointer

Features

  • Two query modes side-by-side: JSONPath (powered by the shared QueryService with wildcards and bracket access) and RFC 6901 JSON Pointer (slash-separated, with ~0/~1 escaping support) — pick the syntax that matches your existing tooling
  • Wildcard `*` at any path segment expands to all object keys or array elements at that level — `$.store.books[*].title` returns every book title without writing a loop
  • Each match is shown with both its concrete path and its value: results aren't a single answer but a list of paths, so a wildcard expansion produces N rows you can copy individually or as a group
  • JSON Pointer mode validates segment syntax: starts with `/`, integer segments index arrays, named segments index objects, `~1` decodes to `/` and `~0` to `~` — same semantics used by JSON Schema instancePath and JSON Patch
  • Per-match copy button writes the value to the clipboard (strings raw, structures as pretty-printed JSON), and Copy all dumps the full `path: value` list as plain text
  • Parse errors and query errors are surfaced separately with the JS engine's full message, so you immediately know whether your JSON or your expression is at fault
  • Load Sample populates a small bookstore document with a working query for the active mode — useful first-run reference for the syntax
  • Pure client-side: JSON, expressions, and results never leave the browser; works offline once the page is cached

How to use

  1. Paste the JSON document you want to query into the left textarea.
  2. Choose a query mode: JSONPath (good for selectors with wildcards) or JSON Pointer (good for naming a single node unambiguously).
  3. Type the expression into the query field — examples are shown in the placeholder for each mode.
  4. Press Run Query or hit Enter in the query field. Matches appear with their concrete paths and values; a counter shows how many were found.
  5. Copy individual values with the icon next to each match, or use Copy all to grab the full `path: value` list.
  6. Use Load Sample to fill both inputs with a working example if you're new to the syntax.

Tips & Best Practices

  • When you're not sure whether your JSON has a key, use a wildcard first to enumerate what's actually there, then narrow down.
  • JSON Pointer paths are sortable as strings — useful when you want to diff sets of paths between two structures.
  • If a query returns one match but you expected several, check for typos (`book` vs `books`) — JSONPath here returns an exact key match, not a fuzzy match.
  • For deeply nested data, JSON Pointer is shorter than JSONPath because it doesn't carry `$` and `.` separators — useful in chat or commit messages.
  • Combine with JSON Tree to navigate visually first, then copy a known-good pointer back into this tool for reuse.

FAQ

What JSONPath syntax is supported?

The minimal-but-useful subset: `$` root, `.key` member access, `['key']` quoted member access (for keys with dots or special characters), `[N]` array index, and `*` wildcard at any segment. Filter expressions (`[?(@.price < 30)]`), descendant operator (`..`), and slicing (`[1:3]`) are not supported here — for those, use the JSON Formatter tool's JSONPath tab which carries a richer engine.

What's the difference between JSONPath and JSON Pointer?

JSONPath is a query language (XPath-for-JSON) — it can select multiple nodes via wildcards, descendants, and predicates. JSON Pointer (RFC 6901) is a path notation — it names exactly ONE node and either it exists or it doesn't. Use JSONPath when you want a result SET; use JSON Pointer when you want a single deterministic location (e.g. for JSON Patch or to copy a failing instancePath out of a schema validator).

Why do I need both modes?

Different tools and standards use different notations. JSON Schema instancePath errors are JSON Pointer. fast-json-patch uses JSON Pointer. JSONPath is what most JSON-querying CLI tools and many libraries expect. Having both modes here means you can copy a path between tools without rewriting it.

How are keys with special characters handled?

JSONPath: quote them in brackets — `$['weird.key']` accesses the key literally named `weird.key`. JSON Pointer: escape per RFC 6901 — `/` in a key becomes `~1`, `~` becomes `~0`. The placeholder shows the standard form for each mode.

What happens if the path doesn't match anything?

You get a 0-matches result and a 'Query returned no matches' note rather than an error. This is the normal JSONPath / JSON Pointer convention: missing paths are absence, not failure. Distinguish absence from malformed input by looking at whether the error row appeared.

Can wildcards descend into nested arrays?

Yes, at each level. `$.users[*].roles[*]` first wildcards across all users, then across each user's roles, producing every role string. The output table shows the resolved concrete path of each match (e.g. `$.users[0].roles[2]`), which is useful when you want to know exactly where a hit came from.

Is anything sent to a server?

No. JSON.parse runs in your browser, JSONPath / JSON Pointer evaluation runs in your browser, and the matches are rendered into the page without any network call. The Network tab in DevTools shows nothing when you press Run Query.

How is this different from JSON Formatter's query tab?

JSON Formatter is a multi-tool: format, validate, schema-check, JSONPath, diff. This standalone JSON Query is the minimal interface: one URL, two modes, results-as-a-list with per-match copy, no extra surface area. Use the Formatter when you want a single view that combines several JSON workflows; use this when you just want to extract values.