JSONPath Tester

Query a JSON document with a small JSONPath subset.

Use this tool

Result

The result appears in this panel after you run the tool.

About this tool

The path is read against the parsed document and the matches are printed. A missing field is an empty result, not a guessed value.

This is a tester for that subset. It is not a full JSONPath engine.

How to use it

  1. Paste a JSON document.
  2. Enter a path such as $.a.b, $[index], or $.a[*].b.
  3. Run the query. Paths outside that subset are rejected.

Limitations

A small walker for dots, indexes, and stars

The path has to start with a dollar sign, and parentheses are refused

A small path language walks a parsed document. The document box is parsed as JSON. The path must start with a dollar sign. If it contains a parenthesis, it is rejected, which keeps script expressions out. The shapes this walker implements are a chain of property names, an index in brackets, and a star. A path that is only the dollar sign returns the whole document as the single element of a list. Results are always printed as a JSON array with a two-space indent, even when one value matched.

Property steps look up a key on an object. A numeric step looks up an index on an array, and it does not look up a numeric key on an object. A star walks the values of an array or the values of an object, then continues the path on each value. A star on anything else contributes nothing. A missing key contributes nothing for that branch. The printed array can therefore be empty. Empty means no match, not a parse failure. A parse failure of the document is a different error, the ordinary JSON error.

Outside the subset

Filters, recursive descent, slices, and unions are not implemented. A path that relies on them will not do what a full JSONPath engine does. Because parentheses are forbidden, you cannot sneak a script through a filter. Bracket names that are not numbers and not a star are a weak fit for this splitter, which breaks the path on dots and brackets. Stay with the three shapes the error message names: a dotted chain, an index, and a star used as a property step.

The array wrapper

Callers sometimes expect the matched value bare. Here the matches are a list, so a single object comes back inside an array. That wrapper is part of the result, and a later JSON formatter will pretty-print it as an array. The walker does not evaluate expressions, and it does not modify the document. Use it to pull values out of one JSON text with a short path. Use the schema tools when you need to judge shape rather than pick a location.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.