Ferramentas Guias
developer Gratuito Sem cadastro

Ferramenta de Consulta JSONPath

Execute expressões JSONPath em dados JSON para extrair, filtrar e explorar estruturas aninhadas.

Carregando ferramenta…

Sobre esta ferramenta

Cole qualquer documento JSON e execute consultas JSONPath para extrair exatamente os dados de que precisa. Suporta raiz ($), filho (.chave), descida recursiva (..chave), curingas ([*]), índices de array, uniões e expressões de filtro como [?(@.age > 18)]. Os resultados são exibidos como JSON destacado com um histórico de consultas para execuções rápidas.

Como usar

  1. 1 Passo 1: Cole ou digite seus dados JSON no painel de entrada à esquerda.
  2. 2 Passo 2: Insira uma expressão JSONPath no campo de consulta (por exemplo, $.store.book[*].author).
  3. 3 Passo 3: Clique em 'Executar Consulta' ou pressione Ctrl+Enter para executar.
  4. 4 Passo 4: Veja os resultados correspondentes como JSON destacado. Clique em 'Copiar Resultado' para copiar para a área de transferência.

What JSONPath is for

JSONPath is a query language for JSON, the way XPath is a query language for XML. Instead of writing loops to dig through nested objects and arrays, you write one compact expression that describes where the data you want lives, and the engine walks the structure and returns every matching value. This tool runs JSONPath expressions against JSON you paste, entirely in your browser, and shows the matched values with syntax highlighting and a match count. It's distinct from a JSON formatter or validator: those check and pretty-print the whole document, whereas JSONPath extracts specific pieces from it.

The syntax, piece by piece

Every expression begins with $, the root of the document. From there you chain steps:

SyntaxMeaningExample
.key or ['key']Child by name$.store.bicycle
[n]Array element by index$.store.book[2]
[-1]Index from the end$.store.book[-1]
[*] or .*Every element/value (wildcard)$.store.book[*].author
..Recursive descent — search at any depth$..price
[a,b]Union — several indices or keys at once$.store.book[0,2]
[?(...)]Filter — keep elements matching a condition$.store.book[?(@.price < 10)]

Inside a filter, @ refers to the current element being tested. This engine supports existence checks (?(@.isbn) keeps items that have an isbn field) and comparisons with ==, !=, >, <, >=, and <= against a number, a quoted string, or true/false/null.

A worked example

Using the bookstore JSON the tool loads by default — a store with an array of four book objects and a bicycle — here is how a few queries resolve:

  • $.store.book[*].author walks every book and pulls its author, returning all four author names.
  • $..price uses recursive descent to find every price anywhere in the tree — the four book prices and the bicycle's, five matches in total. The leading $.store is unnecessary because .. already searches everywhere.
  • $.store.book[?(@.price < 10)] filters the book array to just those under $10 — the two cheapest books — returning the whole object for each match, not only the price.
  • $.store.book[?(@.category == 'fiction')] keeps the three fiction titles; note the single quotes around the string value.
  • $.store.book[?(@.isbn)] is an existence filter: it returns only the books that carry an isbn field, ignoring the two that don't.

The results panel shows the count (e.g. "5 matches") and pretty-prints the matched values; a single match is returned as the value itself, multiple matches as an array.

Filter vs. wildcard: a common confusion

A wildcard [*] returns every element; a filter [?(...)] returns only elements that pass a test. People often reach for a filter when they mean a wildcard, or forget that a filter only operates on an array — in this engine, applying [?(...)] to a plain object yields nothing. So query the array, then filter: $.store.book[?(@.price >= 10)] works, but pointing a filter at a single object does not.

Practical tips

  • Use .. when you don't know the depth. If a field is buried at varying levels, $..fieldName finds them all without spelling out the path.
  • Quote string comparisons. Write @.status == 'active', not @.status == active — an unquoted bare word won't match.
  • Test incrementally. Start with $.store, confirm it returns the object, then add one step at a time. The match count tells you immediately when a step narrows to zero.
  • Click a sample query to load both the expression and the example JSON, then edit from there — the fastest way to learn the syntax by experiment.
  • Remember $ matches one value, not a list. Returning multiple values requires a wildcard, union, recursive descent, or filter somewhere in the path.

Where JSONPath is genuinely useful

It shines for pulling a few fields out of large API responses, writing assertions in API tests ("the response has at least one order with status shipped"), configuring data pipelines and log processors, and exploring an unfamiliar JSON payload without writing throwaway code. Many tools — from jq-style processors to test frameworks and no-code platforms — accept JSONPath-style expressions, so the syntax transfers widely.

Everything runs locally

The JSON you paste and every query you run are processed entirely in your browser by a JavaScript engine; nothing is uploaded. That means you can safely test queries against sensitive or proprietary JSON, and the tool keeps working with your network disconnected. (Note this is a focused JSONPath implementation covering the operators above; very advanced extensions like array slices and script expressions aren't part of it.)

Perguntas frequentes

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}