JSONPath Tester

Run live JSONPath queries and see matched values and paths.

Query:
JSON Input
Matches
run a query to see matched values

Related Tools

Documentation

What is JSONPath Tester?

JSONPath Tester runs a JSONPath query against a JSON document and shows every matching value, so you can iterate on a selector without writing any code. JSONPath does for JSON roughly what XPath does for XML: a compact expression language for reaching into nested structures.

How it works

The input panel is parsed with JSON.parse(), and your query is passed straight to the jsonpath-plus library's JSONPath() function with resultType: 'all', which returns both the matched value and its normalized path for every hit — that's what powers the two-line result cards (path on top, value below). A JSON syntax error in the document is caught and reported with a line number the same way the JSON Viewer does; a bad JSONPath expression (unbalanced brackets, an invalid filter) is caught separately and reported without a line number, since it's a query error rather than a document error.

Features

  • Full jsonpath-plus syntax, including filter expressions and script expressions
  • Shows the matched path and value for every result, not just the value
  • Match count in the results header (0 matches is distinguished from "no query run yet")
  • Resizable split panel between document and query results
  • Built-in sample document and query to try the syntax immediately

Example

Document:

{
  "tools": [
    { "slug": "json-formatter", "category": "json", "status": "live" },
    { "slug": "yaml-formatter", "category": "yaml", "status": "live" },
    { "slug": "jsonpath", "category": "json", "status": "planned" }
  ]
}

Query: $.tools[?(@.category=="json")].slug

Matches (2): "json-formatter" and "jsonpath" — the filter ?(@.category=="json") keeps only array items where the current item's (@) category equals "json", and .slug then projects each surviving item down to just that field.

Common errors

Forgetting the leading $ (every JSONPath expression must start from the root) or leaving a filter's parentheses unbalanced produces a query error rather than an empty result. A syntactically valid query that just doesn't match anything (e.g. a category that doesn't exist in the document) returns "0 matches", not an error — worth distinguishing when debugging a selector that "isn't working".

Best practices

Build a query incrementally — start with $.tools[*] to confirm you're selecting the right array, then narrow with a filter, then project down to the field you need. Copy a path from the JSON Viewer's tree as a starting point when you're not sure of the exact structure you're querying.

Spec

RFC 9535 — JSONPath: Query Expressions for JSON (jsonpath-plus supports this syntax plus additional non-standard extensions)

Frequently Asked Questions

What is JSONPath?

A query language for JSON, similar in spirit to XPath for XML — expressions like $.tools[*].slug select values out of a document without writing a full parser.

What does $ mean?

It refers to the root of the document. Every JSONPath expression starts from $.

Can I filter with conditions?

Yes — expressions like $.tools[?(@.category=="json")] select array items matching a condition on the current item (@).

What library powers this?

jsonpath-plus, which supports the common JSONPath syntax plus some extensions beyond the original spec.

Is my data uploaded anywhere?

No — queries run entirely in your browser.