Skip to main content

JSONPath tester

Query JSON data with a simple JSONPath expression. Processing is performed directly in your browser.

  • Clipboard
  • Export

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Expression

Was this tool useful?

How does this tool work?

This tester selects one value from a JSON document using a simple path. Use it to locate a nested field, verify an array index or investigate a missing property in a copied API response. Results are displayed as JSON: objects keep their structure, strings retain quotation marks and null stays distinct from no match. Evaluation happens in your browser. The tool neither calls an API URL nor uploads the document to a query service.

Start the path with $, representing the whole document. Dot notation selects ordinary properties, such as $.user.name. Brackets containing an integer select an array entry, starting at zero. Only nonnegative integer indices are supported: a three-element array has positions 0, 1 and 2.

Write keys containing spaces, dots or hyphens inside quoted brackets. $["a.b"] selects the literal name a.b, while $.a.b selects b inside a. Both single and double quotes work for bracketed keys. Special characters need the escape sequences recognized by the selector.

This is a navigation subset rather than a complete RFC 9535 implementation. Filters, wildcards, slices, negative indices and recursive descent are rejected explicitly. An expression such as $..name must be replaced with an exact path; it is not treated as a global search. A supported expression selects at most one value, not a standardized node list.

The browser parses values using JavaScript JSON types. Numbers outside its precision range may therefore be rounded when the result is read and serialized. Supply large identifiers as strings. Only the document’s own properties are traversed: an inherited name such as constructor cannot become a false match.

How to use this tool

  1. Supply valid JSON

    Paste the complete JSON body without HTTP headers or Markdown fences. Root arrays are supported and can be traversed directly using $[0].

  2. Build an exact path

    Begin with $, add properties incrementally and use brackets for indices or special keys. Filter expressions copied from another engine are not supported here.

  3. Interpret the selected value

    Run the expression and inspect both the result and its JSON type. Editing the document or path hides the previous result so it is not mistaken for a current selection.

Use cases

Check an API response field

Target a value such as $.user.id before implementing extraction in your application. The tester does not contact the server or check how recent the pasted response is.

Check positions in an array

Select the first entry with [0], then try another known index. An out-of-range index yields no match rather than creating a replacement entry.

Investigate a dotted property name

Compare dot notation with a quoted key to distinguish nested objects from a single property whose name actually includes a separator.

Examples

Select a dotted key followed by a spaced key

The first brackets select a.b as a complete name; [0] selects the first object and the final brackets select quoted key. Output is a valid JSON string including its quotes.

Input

{"a.b":[{"quoted key":"Ada"}]}
$["a.b"][0]['quoted key']

Result

"Ada"

Ignore an inherited property

The empty document has no own constructor property. The tester returns its no-match marker even though JavaScript objects normally inherit that name through their prototype.

Input

{}
$.constructor

Result

[]

Tips and best practices

  • Check the complete document with $ before adding one segment at a time. This shows precisely where a selection stops matching.
  • The output [] can mean no match or an actual empty array. Inspect the parent when your workflow needs to distinguish the two.
  • null is a present value, whereas a missing path selects nothing. Keep those cases separate when designing validation rules.
  • Use XPath for XML documents. Changing a file extension does not turn XML into a JSON structure.

Sources and references

Frequently asked questions

Why is my JSONPath filter or wildcard rejected?

This tester implements exact property and index paths only. Unsupported syntax is rejected instead of returning incomplete results presented as full standard compliance.

How do I select a property containing a dot?

Put the entire key inside quoted brackets, for example $["a.b"]. The expression $.a.b describes two object levels and does not address that same literal key.

Do array indices start at one or zero?

Zero. [0] selects the first entry and [1] the second. Negative indices, fractional indices and slices are unavailable; a nonexistent position produces the no-match marker [].

Why does a selected string include quotation marks?

Output preserves the selected JSON type: "Ada" is a JSON string, while Ada without quotes is not valid JSON. Objects and arrays are serialized with indentation for readability.

Related tools

Tools similar or complementary to this one.

Similar tools

Format, minify, and validate JSON to make it easier to read or more compact.

DevelopmentFeaturedUse this tool

Validate a JSON document against a schema and locate every error precisely.

DevelopmentFeaturedUse this tool

Test an XPath expression against XML and immediately inspect the matching results.

DevelopmentUse this tool