Free tool

JSONPath tester

Type a JSONPath expression and see every match, with its path, as you type. Switch to the document view to see matches highlighted in your JSON, and click any key or item to get its path.

Free · no sign-up · runs in your browser, nothing is uploaded

JSON
562 B
Drop a .json file here, or click to open one
Result

Loading JSONPath…

JSONPath cheat sheet

Results are for the sample bookstore document in the tester (load it with [sample]).

ExpressionMeansResult on the sample
$The root of the documentthe whole document
$.store.bicycle.colorChild by name (dot notation)["red"]
$['store']['bicycle']['color']Child by name (bracket notation, for keys with spaces or dashes)["red"]
$.store.book[0].titleArray item by index, from 0["Sayings of the Century"]
$.store.book[-1].titleIndex from the end (RFC 9535)["The Lord of the Rings"]
$.store.book[*].authorWildcard: every item or property4 authors
$..authorRecursive descent: at any depth4 authors
$.store.*Every child of storethe book array and the bicycle
$..book[0,1].titleUnion of indexesfirst two titles
$..book[1:3].titleSlice [start:end], end excluded["Sword of Honour", "Moby Dick"]
$..book[::2].titleSlice with a stepitems 0 and 2
$..book[?(@.isbn)].titleFilter: key exists["Moby Dick", "The Lord of the Rings"]
$..book[?(@.price < 10)].titleFilter: comparison["Sayings of the Century", "Moby Dick"]
$..book[?(@.category == "fiction" && @.price > 10)]Filter: && and ||2 books
$..book[?(@.author.match(/tolkien/i))]Filter: regex (jsonpath-plus)1 book
$.store.*~Property names (jsonpath-plus)["book", "bicycle"]
$..*Every value in the document27 values

Filters, and how implementations differ

JSONPath existed for 17 years as a 2007 blog post before RFC 9535 standardised it, so libraries disagree on the details. This tester runs jsonpath-plus, which follows Goessner's original syntax with extras, and rewrites two common RFC forms so they work too: filters without parentheses ([?@.price < 10]) and negative indexes ([-1]).

FeatureGoessner / jsonpath-plusRFC 9535
Filter[?(@.price < 10)][?@.price < 10]
Last item[-1:] (a slice)[-1]
Regex@.title.match(/x/i)match(@.title, 'x') or search()
Array length@.length (JavaScript)length(@)
Stringssingle or double quotessingle or double quotes

RFC 9535 function extensions such as length(), count(), match(), search() and value() are not available here. Filters run in jsonpath-plus's safe evaluator, which supports comparisons, &&, ||, ! and property access, without running arbitrary JavaScript.

JSONPath in code and on the command line

JavaScript with jsonpath-plus:

import { JSONPath } from 'jsonpath-plus';

const titles = JSONPath({ path: '$..book[?(@.price < 10)].title', json: data });
// ['Sayings of the Century', 'Moby Dick']

Python with jsonpath-ng (filters need the ext parser):

from jsonpath_ng.ext import parse

titles = [m.value for m in parse('$..book[?(@.price < 10)].title').find(data)]

kubectl uses JSONPath templates in curly braces, and the leading $ is optional:

kubectl get pods -o jsonpath='{.items[*].metadata.name}'
kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.phase}{"\n"}{end}'

JSONPath vs jq vs JMESPath

Three query languages for JSON with different syntax. The same query, titles of books under 10, in each:

LanguageQueryWhere you meet it
JSONPath$..book[?(@.price < 10)].titleKubernetes, API testing tools, many libraries
jq.store.book[] | select(.price < 10) | .titleCommand line, shell scripts
JMESPathstore.book[?price < `10`].titleAWS CLI --query, Azure CLI, Ansible
PostgreSQL$.store.book[*] ? (@.price < 10).titlejsonb_path_query() in SQL

PostgreSQL's SQL/JSON path looks like JSONPath but puts filters after the step (? (@.price < 10)), so expressions do not copy across unchanged.

Gotchas

  • Keys are case-sensitive. $.Store finds nothing in a document with store.
  • Quote keys with spaces, dashes or dots. $.first-name does not work; write $['first-name'].
  • No match is not an error. A wrong path returns an empty list. Check each step from the left, or click the key in the document view to get the exact path.
  • .. can be slow and broad. $..id also matches ids inside nested objects you did not mean. Use the full path when you know it.

Format or repair the JSON first with the JSON formatter, describe its shape with the JSON Schema generator or JSON to TypeScript, and find more API tools in API tools on DevHunt.

FAQ

What is JSONPath?+

JSONPath is a query language for JSON, in the spirit of XPath for XML. $ is the document root, .name or ['name'] picks a property, [0] an array item, * every child, .. searches at any depth, and [?( )] filters by a condition. Stefan Goessner described it in 2007, and RFC 9535 standardised it in February 2024.

How do I filter an array by a value in JSONPath?+

Use a filter: $.store.book[?(@.price < 10)] returns the books with a price under 10. @ is the item being tested. Combine conditions with && and ||, test that a key exists with [?(@.isbn)], and compare strings with == "fiction". RFC 9535 writes the same filter without parentheses, [?@.price < 10]; this tester accepts both.

Why is the JSONPath result always an array?+

A JSONPath can match any number of nodes: none, one or many, so evaluators return a list. Even $.store.bicycle.color returns ["red"]. In code, take the first item when you expect a single value, and handle the empty list when the path does not exist.

What is the difference between JSONPath and JSON Pointer?+

JSON Pointer (RFC 6901) addresses exactly one value with a plain path like /store/book/0/title, and has no wildcards or filters. JSON Patch and JSON Schema errors use it. JSONPath is a query that can match many values. The tester shows each match in both forms.

How do I get the last item of an array?+

In RFC 9535, $.store.book[-1]. Older implementations such as jsonpath-plus need a slice, $.store.book[-1:], which returns a one-item list. This tester rewrites [-1] to the slice for you, so both work.

How do I get the keys of an object with JSONPath?+

Standard JSONPath returns values, not names. jsonpath-plus adds ~ for property names: $.store.*~ returns ["book", "bicycle"]. In plain JavaScript, Object.keys(obj) is simpler.

Is my JSON uploaded?+

No. The expression runs in your browser with the open source jsonpath-plus library, using its safe evaluator for filters. Nothing is sent to a server. Short inputs are kept in the page URL so you can share a result.

Sources: RFC 9535: JSONPath · RFC 6901: JSON Pointer · Stefan Goessner: JSONPath (2007) · jsonpath-plus · jsonpath-ng · kubectl JSONPath support · jq manual · JMESPath · PostgreSQL SQL/JSON path. Checked 2026-10-29.