JSON Path Finder Guide: How to Query JSON Data with JSONPath
JSONPath is a powerful query language for extracting data from JSON documents. Whether you are building API integrations, writing data pipelines, or debugging JSON responses, JSONPath lets you find exactly what you need with expressive, readable expressions. This guide covers everything from basic syntax to advanced filters and real-world use cases.
Ready to query your JSON?
Use the free JSON Path Finder — paste JSON, click the tree to discover paths, and evaluate JSONPath expressions in your browser. No signup, no upload.
Try JSON Path FinderTable of Contents
What is JSONPath?
JSONPath is a query language designed specifically for navigating JSON documents. Inspired by XPath (which serves a similar purpose for XML), JSONPath provides a concise syntax for reaching into deeply nested JSON structures and extracting specific values.
Every JSONPath expression starts with $, which represents the root of the JSON document. From there, you traverse through properties, array indices, or apply filters to pinpoint the data you need.
Example JSON
{
"store": {
"book": [
{ "title": "1984", "author": "Orwell", "price": 9.99 },
{ "title": "Dune", "author": "Herbert", "price": 14.99 },
{ "title": "Neuromancer", "author": "Gibson", "price": 12.99 }
],
"bicycle": {
"color": "red",
"price": 199
}
}
}JSONPath Basic Syntax
JSONPath supports two notation styles — dot notation and bracket notation. Both access the same data but have different strengths.
Dot Notation
The most readable form. Use it when property names are simple identifiers (no spaces, no special characters):
$.store.book[0].title → "1984" $.store.bicycle.color → "red"
Bracket Notation
Required when property names contain spaces, special characters, or when using computed keys:
$['store']['book'][0]['title'] → "1984" $['store']['bicycle']['color'] → "red"
JSONPath Operators Guide
JSONPath provides a rich set of operators for navigating JSON data. Here is a complete reference:
$ — Root Object
The root of the JSON document. All expressions start here.
$ → the entire JSON document
.property or ['property'] — Child Operator
Access a direct child property of an object.
$.store.bicycle.color → "red"
[*] — Wildcard
Selects all elements of an array or all properties of an object.
$.store.book[*].title → ["1984", "Dune", "Neuromancer"]
.. — Recursive Descent
Search through all descendants at any depth. The most powerful JSONPath operator.
$..price → [9.99, 14.99, 12.99, 199]
[?(…)] — Filter Expression
Filters array elements using boolean expressions. Supports comparison operators, logical operators, and existential checks.
$.store.book[?(@.price < 14)].title -> ["1984", "Neuromancer"] $.store.book[?(@.price >= 10 && @.price <= 15)].title -> ["Dune", "Neuromancer"] $..book[?(@.author)] -> books that have an author field
[start:end:step] — Array Slice
Extract a sub-array by index range, similar to JavaScript slice.
$.store.book[0:2].title → ["1984", "Dune"] $.store.book[::-1].title → ["Neuromancer", "Dune", "1984"]
[0,2] — Union
Select multiple specific indices from an array.
$.store.book[0,2].title → ["1984", "Neuromancer"]
Practical JSONPath Examples
Here are real-world JSONPath patterns you will use frequently:
Find all titles in a nested structure
$..title
Recursive descent finds title at any depth — ideal for unknown or deeply nested schemas.
Get the last element of an array
$.store.book[-1:]
Negative indices count from the end, just like Python or JavaScript.
Filter with negation
$.store.book[?(@.price < 10)]
Find books priced under $10. Supports <, <=, >, >=, ==, != operators.
Check for existence of a field
$.store.book[?(@.isbn)]
Selects only objects that have an isbn field — great for filtering sparse data.
Kubernetes-style JSONPath
{.items[*].metadata.name}Kubernetes uses a curly-brace variant. Our JSON Path Finder supports this syntax too.
Common JSONPath Mistakes & How to Fix Them
Even experienced developers run into JSONPath issues. Here are the most frequent mistakes and their solutions, so you can debug expressions faster.
1. Using single quotes in filters
JSONPath filters require double quotes around string literals.$[?(@.status == 'active')] will fail in most implementations.
2. Forgetting the root symbol ($)
Every JSONPath expression must start with $. Writing .store.book instead of$.store.book will return empty results.
3. Confusing dot and bracket notation
Dot notation only works for simple identifiers.$.store.0.name is invalid — use$.store[0].name for numeric array indices.
4. Assuming regex support
Standard JSONPath (RFC 9535) does not support regular expressions. Only specific libraries like Jayway add =~ operator. For portability, use exact string matches or wildcards.
5. Using unsupported features in your target library
Not all JSONPath libraries support every operator. For example, some older JavaScript libraries do not support [::-1] slice syntax. Always test your expression with the exact library version you deploy in production.
Common Use Cases for JSONPath
API Response Parsing
Extract specific fields from complex API responses without writing manual traversal code. For example, $.data.users[*].email extracts all user emails from a paginated API response.
Data Validation & Testing
In automated tests, use JSONPath to assert that specific values exist at expected paths. JSONPath filters let you verify data conditions like "all items have a non-null price."
Data Transformation Pipelines
Use JSONPath expressions in ETL tools like Airbyte, Apache Nifi, and custom data pipelines to extract, transform, and load specific data points from large JSON payloads.
Kubernetes Resource Queries
Kubernetes uses JSONPath in kubectl get commands to select specific fields from resource definitions. For example: kubectl get pods -o jsonpath='{.items[*].metadata.name}'
JSONPath Library Support by Language
JSONPath has multiple implementations across programming languages, and they do not all support the same feature set. The table below compares popular libraries and the operators they support, so you can choose the right one for your stack.
| Language | Library | Dot Notation | Filter | Slice | Regex |
|---|---|---|---|---|---|
| JavaScript | jsonpath-plus | ✓ | ✓ | ✓ | — |
| JavaScript | JSONPath (dchester) | ✓ | ✓ | ✓ | — |
| Java | Jayway JsonPath | ✓ | ✓ | ✓ | ✓ |
| Python | jsonpath-ng | ✓ | ✓ | ✓ | — |
| Go | k8s jsonpath | ✓ | — | — | — |
| Go | ohler55 / oj | ✓ | ✓ | ✓ | — |
Tip: RFC 9535 (published 2024) is the first standardized JSONPath specification. Libraries that claim RFC 9535 compliance offer the best interoperability. Always test expressions with the exact library version you use in production.
JSONPath Explainer vs JSON Path Finder
FormatList offers two complementary JSONPath tools — each serves a different purpose:
| JSONPath Explainer | JSON Path Finder | |
|---|---|---|
| Purpose | Explains what an expression does | Evaluates expressions against real data |
| Input | Any JSONPath expression | JSON data + JSONPath expression |
| Output | Plain English breakdown | Matching values with their paths |
| Best for | Learning and debugging expressions | Testing queries against live data |
Frequently Asked Questions About JSONPath
What is JSONPath?
JSONPath is a query language for JSON data, similar to XPath for XML. It lets you navigate and extract specific values from complex JSON structures using expressive path expressions.
How do I find the JSONPath for a value?
Paste your JSON into a JSON Path Finder tool, browse the interactive tree, and click any node to see its exact JSONPath. You can then evaluate custom expressions against your data to extract matching values.
What's the difference between dot and bracket notation?
Dot notation ($.store.book.title) is shorter and works for simple property names. Bracket notation ($['store']['book']['title']) handles special characters, spaces, and numeric keys. Most JSONPath implementations accept both.
Is JSONPath the same as JavaScript object access?
Similar but not identical. JSONPath uses $ as the root, supports recursive descent ($..property), filters ($[?(@.price > 10)]), wildcards, and slices — features that JavaScript bracket notation alone does not provide natively.
Is the JSON Path Finder free to use?
Yes. FormatList's JSON Path Finder is completely free, works entirely in your browser, and requires no signup or account. Your JSON data never leaves your computer.
Why is my JSONPath expression returning empty results?
Common causes include: using single quotes instead of double quotes in filters ($[?(@.status == "active")] not 'active'), forgetting the $ root symbol, incorrect bracket syntax ($.items[0] vs $[items][0]), or trying to access a property that does not exist. Use a JSON Path Finder to validate your expression against real data.
Does JSONPath support regular expressions?
Standard JSONPath (RFC 9535) does not include regular expression filters. However, some implementations like Jayway (Java) and certain JavaScript libraries add =~ operator support. For maximum portability, prefer exact string matches or wildcard patterns.
What are the most popular JSONPath libraries?
For JavaScript: jsonpath-plus and JSONPath. For Java: Jayway JSONPath and Spring's JsonPath. For Python: jsonpath-ng. For Go: k8s.io/client-go/util/jsonpath. Each has slightly different syntax extensions, so test your expressions with the specific library you use in production.
About this guide
This article was written and reviewed by the FormatList team, a group of developers focused on building practical, privacy-first developer tools. All code examples and JSONPath expressions in this guide have been tested against real JSON data. Last updated on .