JSONPath Finder & Evaluator
Find and test a JSONPath expression to extract matching values from your JSON:
What is JSONPath?
JSONPath is XPath for JSON—a query language that lets you extract values from JSON documents using path expressions. Instead of writing loops to find data, you write a single expression like $.users[*].email to get all user emails. If you don't know the key name or path yet, use JSON search to find keys and values by text and see the path to each match.
Syntax Quick Reference
| Expression | Description | Example |
|---|---|---|
$ | Root object | $ → entire document |
. | Child property | $.store → store object |
.. | Recursive descent (find anywhere) | $..price → all prices |
[n] | Array index | $.items[0] → first item |
[*] | All elements | $.items[*] → all items |
[-1] | Last element | $.items[-1] → last item |
[0:3] | Array slice | $.items[0:3] → first 3 items |
[?(@.x)] | Filter expression | $..book[?(@.price<10)] |
Working Example
Consider this API response:
{
"store": {
"name": "TechMart",
"products": [
{ "id": 1, "name": "Laptop", "price": 999, "inStock": true },
{ "id": 2, "name": "Mouse", "price": 29, "inStock": true },
{ "id": 3, "name": "Keyboard", "price": 79, "inStock": false },
{ "id": 4, "name": "Monitor", "price": 299, "inStock": true }
],
"location": {
"city": "San Francisco",
"country": "USA"
}
}
}Example Queries
| Query | Result |
|---|---|
$.store.name | "TechMart" |
$.store.products[*].name | ["Laptop", "Mouse", "Keyboard", "Monitor"] |
$..price | [999, 29, 79, 299] |
$.store.products[0] | {"id": 1, "name": "Laptop", ...} |
$.store.products[-1].name | "Monitor" |
$.store.products[0:2].name | ["Laptop", "Mouse"] |
$.store.products[?(@.price<100)].name | ["Mouse", "Keyboard"] |
$.store.products[?(@.inStock==true)].name | ["Laptop", "Mouse", "Monitor"] |
$..city | ["San Francisco"] |
Filter Expressions
Filters ([?()]) let you select elements that match a condition. Use @ to reference the current element:
[?(@.price > 100)]— Price greater than 100[?(@.price <= 50)]— Price 50 or less[?(@.inStock == true)]— In stock items[?(@.name)]— Has a name property[?(@.tags[*] == "sale")]— Has "sale" in tags array
Real-World Use Cases
Extract All Emails from API Response
$..emailFinds every email field anywhere in the document—useful when you don't know the exact structure.
Get Failed Items from a Batch Response
$.results[?(@.status == "failed")]Filters to only the items that failed processing.
Find Products in a Price Range
$.products[?(@.price >= 10 && @.price <= 50)]Combines multiple conditions with &&.
Get Specific Fields from Nested Arrays
$.orders[*].items[*].skuExtracts SKUs from all items in all orders.
Pro Tips
- 💡 Start with
$and build up — Test$.storebefore trying$.store.products[?(@.price>100)].name - 💡 Use
..when you're not sure of the path —$..idfinds all IDs regardless of nesting depth - 💡 Filter returns an array — Even if one item matches, you get
[item]notitem - 💡 Dot notation vs bracket notation —
$.store.nameequals$['store']['name']. Use brackets for special characters:$['my-field']
JSONPath vs Alternatives
| Tool | Best For |
|---|---|
| JSONPath | Quick extraction, language-agnostic, browser-friendly |
| jq | Command-line processing, complex transformations |
| JavaScript | When you need full programming logic |
Related Tools
- JSON Validator — Validate and format JSON
- JSON Diff — Compare two JSON documents
- JSON Schema Validator — Validate against a schema