JSONPath Tester

Test JSONPath expressions against any JSON document. Results appear instantly in your browser — nothing is sent to a server.

Ctrl+Enter to evaluate

JSONPath Quick Reference

Expression Meaning
$Root of the document
.keyChild key (dot notation)
['key']Child key (bracket notation — use for keys with spaces)
[0]Array index (zero-based)
[*]All array elements
[0,2]Specific array indices
[0:2]Array slice (indices 0 and 1)
..Recursive descent (search all descendants)
[?(@.price < 10)]Filter expression

Common Examples

  • $.store.book[*].author — all book authors
  • $..author — all author fields anywhere in the document
  • $.store.book[0] — first book object
  • $.store.book[?(@.price < 10)] — books cheaper than $10
  • $.store.book[-1] — last book (JSONPath Plus extension)
  • $.store.* — all values under store

How JSONPath Evaluation Works

When to Use the JSONPath Tester

Worked example: querying an API response

Suppose an API returns a list of products and you want just the names of the in-stock items under $10. Given this JSON:

{
  "products": [
    { "name": "Pen",    "price": 3,  "inStock": true },
    { "name": "Notebook","price": 8, "inStock": true },
    { "name": "Desk",    "price": 120,"inStock": false }
  ]
}

Here is how a few expressions evaluate against it:

Expression Result
$.products[*].name["Pen","Notebook","Desk"]
$.products[0]the first product object
$.products[?(@.price < 10)].name["Pen","Notebook"]
$.products[?(@.inStock == false)].name["Desk"]
$..price[3,8,120] (recursive descent)

A few things to notice: the result is always an array, even when a single node matches; the recursive-descent operator $..price finds every price key at any depth; and filter predicates use @ to refer to the current element. Test each expression above in the tool to see the matched nodes highlighted, then adapt them to your own data. If you need to transform or reshape the extracted values rather than just select them, pair JSONPath with the JSON to TypeScript or JSON to CSV tools, and use the JSON Viewer to explore an unfamiliar document's structure before writing an expression.

Frequently Asked Questions

What is JSONPath?

JSONPath is a query language for JSON, analogous to XPath for XML. It lets you select nodes from a JSON document using path expressions. The standard is defined in RFC 9535 (published 2024). Common uses include extracting values from API responses and configuring monitoring rules.

What is the difference between JSONPath and JSONPath Plus?

JSONPath Plus is a JavaScript library that extends standard JSONPath with additional features: parent selectors (^), type selectors (@string(), @number()), and arithmetic in filter expressions. This tool uses JSONPath Plus, so all standard expressions work, plus extended syntax.

Why does my expression return an array?

JSONPath always returns an array of matches, even when only one value matches. This is by design — a path expression like $.name returns ["John"], not "John". If you need the scalar value, take the first element of the result array.

Is my JSON data sent to a server?

No. JSONPath evaluation happens entirely in your browser using the JSONPath Plus JavaScript library loaded from a CDN. Your JSON data never leaves your device.

What is the difference between JSONPath and jq?

JSONPath is a standardised query language for selecting values from JSON (RFC 9535). jq is a full command-line JSON processor with its own scripting language that supports both querying and transforming JSON. Use JSONPath for selecting data in APIs, config rules, and testing frameworks; use jq for complex transformations in shell scripts and pipelines.

Does order matter in JSONPath array selectors?

Yes for index-based selectors — [0] and [2] are order-sensitive and select elements at those positions. No for filter expressions — [?(@.active==true)] matches all qualifying elements regardless of their position in the array.

How do I get the path of each JSONPath match?

The matches table lists the full path of every result alongside its value, in both JSONPath bracket notation such as $['store']['book'][0]['author'] and RFC 6901 JSON Pointer form such as /store/book/0/author. Each row has a copy button for its path, and you can switch the result panel to show paths or pointers instead of values. Knowing where a match came from matters when a query returns several values and you need to write back to one of them.

Can I see which parts of my JSON matched?

Yes. Below the results the source document is shown pretty-printed with every matched node highlighted, so you can see exactly what the expression selected rather than only the extracted values. Highlighting is skipped automatically for very large documents to keep the page responsive.

Why does my expression return results even though it looks wrong?

JSONPath-Plus is lenient about malformed expressions. Something like $[ with an unclosed bracket is not rejected — it quietly evaluates as $ and returns the whole document, which looks like a working query. This tool checks the expression separately for unbalanced brackets, parentheses and quotes, and shows a warning when it finds one, even if matches were returned.