JSON
Tester JSONPath
Test di espressioni JSONPath su dati JSON reali — anteprima istantanea dei valori trovati e dei loro percorsi.
$ — radice · .key / ['key'] — proprietà · .. — ricerca ricorsiva · [*] — tutti gli elementi · [0,1] — indici · [0:2] — sezione · [?(@.price<10)] — filtro
—
JSONPath lets you reach into nested JSON values the way XPath does for XML — a compact path string like $.users[0].email instead of manually walking the structure. This tool lets you test an expression against real data and see the result instantly.
How to use it
- Paste JSON data into one field and a JSONPath expression into the other.
- The result shows every matched value along with its exact path, even when there are several matches.
- Use [*] to iterate over every array element, or a filter like [?(@.price > 100)] for conditional selection.
Common uses
- Working out the right JSONPath expression to pull a specific field from an API response before pasting it into code.
- Testing data-transformation or message-routing rules that rely on JSONPath (for example, in AWS Step Functions or an API Gateway).
- Quickly locating a value in a large, deeply nested JSON document without scrolling through it manually.
Things to keep in mind
There's no single official JSONPath standard — the basic syntax (dots, brackets, *) is supported the same way everywhere, but filters and more advanced expressions differ between libraries.
Array indexing in JSONPath starts at zero, like in most programming languages — [0] means the first element.
Articolo su questo strumento: JSONPath: interrogare dati JSON senza analizzarli a mano
Domande frequenti
Che cos'è JSONPath e a cosa serve questo strumento?
JSONPath è un linguaggio per selezionare valori all'interno di un documento JSON, concettualmente simile a XPath per XML; questo strumento valuta un'espressione su un JSON reale e mostra i valori corrispondenti insieme al loro percorso.
Quali sono le sintassi di base da conoscere?
$ indica la radice, .chiave o ['chiave'] accede a una proprietà, .. esegue una discesa ricorsiva a qualsiasi profondità, [*] seleziona tutti gli elementi, [0,1] indici specifici, [0:2] uno slice e [?(@.price<10)] un'espressione di filtro.
I miei dati JSON vengono caricati da qualche parte?
No, l'espressione viene valutata interamente nel browser tramite JavaScript; nulla viene inviato a un server.
Come si accede a una chiave che contiene un punto o uno spazio?
Con le parentesi quadre e le virgolette: $['user.name'] invece di $.user.name — altrimenti il parser interpreta il punto come separatore di annidamento e non come parte del nome della chiave.
Esiste un unico standard ufficiale per JSONPath?
No. La sintassi di base (punti, parentesi, asterisco) è supportata praticamente ovunque allo stesso modo, ma i filtri e le espressioni avanzate variano tra le librerie — verifica la compatibilità per le espressioni complesse.