Query and extract data from JSON using JSONPath expressions. Paste your JSON, write a path expression, and see matching results instantly. Free, no signup required.
Open JSONPath Evaluator →JSONPath is a query language for JSON documents, analogous to how XPath is used to query XML. It provides a concise expression syntax for navigating the structure of a JSON document and extracting specific values, arrays, or sub-objects. JSONPath was originally proposed by Stefan Goessner in 2007 and has since become one of the most widely used tools in the JSON ecosystem.
A formal standard for JSONPath has now been published as RFC 9535 (2024), replacing the informally-specified original version with a rigorous definition. Most libraries implement a superset of the original Goessner spec.
JSONPath is embedded in many popular tools and specifications:
kubectl output formattingThe following table covers the core JSONPath operators and what each one does:
| Operator | Description | Example |
|---|---|---|
$ | Root element. Every path starts here. | $ |
. | Child operator. Access a named property. | $.user.name |
.. | Recursive descent. Find key at any depth. | $..name |
[n] | Array index (zero-based). | $.items[0] |
[start:end] | Array slice (like Python). | $.items[0:3] |
* | Wildcard. Matches all children. | $.users[*].email |
[?(expr)] | Filter expression. Select by condition. | $.items[?(@.price < 50)] |
@ | Current node (used inside filters). | @.active == true |
[a,b,c] | Union. Select multiple indices or keys. | $.items[0,2,4] |
Given this sample JSON document representing a bookstore:
{
"store": {
"book": [
{ "category": "fiction", "title": "Dune", "author": "Frank Herbert", "price": 8.99 },
{ "category": "fiction", "title": "Neuromancer", "author": "William Gibson", "price": 11.99 },
{ "category": "reference", "title": "Pro Git", "author": "Scott Chacon", "price": 0 }
],
"location": "New York"
}
}
| JSONPath Expression | Result |
|---|---|
$.store.book[0].title | "Dune" |
$.store.book[*].author | ["Frank Herbert", "William Gibson", "Scott Chacon"] |
$..price | [8.99, 11.99, 0] |
$.store.book[?(@.price > 9)] | [ Neuromancer object ] |
$.store.book[?(@.category == "reference")] | [ Pro Git object ] |
$.store.book[-1:] | [ Pro Git object ] (last element) |
JSONPath was explicitly modeled on XPath, so the two share many conceptual similarities. However, there are important differences that reflect the structural differences between JSON and XML:
/ for the root; JSONPath uses $./ (e.g., /store/book); JSONPath uses . (e.g., $.store.book).//; JSONPath uses ...@attr in XPath); JSON has no attribute concept, so @ in JSONPath refers to the current node in a filter.For most practical use cases involving JSON APIs and data processing, JSONPath's simpler model is more than sufficient and is easier to learn than the full XPath specification.
JSONPath is a query language for JSON, similar to how XPath works for XML. It lets you navigate and extract specific values from a JSON document using a path expression syntax. JSONPath was originally proposed by Stefan Goessner in 2007. A standardized version is now defined in RFC 9535 (2024). It is widely supported in libraries for Java, Python, JavaScript, Go, and many other languages.
The $ symbol represents the root of the JSON document. Every valid JSONPath expression must start with $ to indicate you are querying from the top level of the document. For example, $.store.book[0].title retrieves the title of the first book in the store object starting from the document root.
A single dot (.) is the child operator and accesses an immediate child property. For example, $.user.name accesses the name property directly inside user. Two dots (..) are the recursive descent operator and search for a key at any depth in the document. For example, $..name finds every name field no matter how deeply nested it appears in the structure.
Use the filter expression syntax with [?()]. The @ symbol refers to the current element being evaluated. For example, $.store.book[?(@.price < 10)] returns all book objects where the price property is less than 10. You can use comparison operators (==, !=, <, >, <=, >=) and string comparisons in filter expressions.
Free, instant, 100% private. No account needed.
Open JSONPath Evaluator →Also useful: JWT Decoder | JSON Validator | JSON Formatter | JSON Diff | JSON Schema Validator | JSON to TypeScript