JSON Search
Search and query JSON online using JMESPath.
JMESPath query guide
Use JMESPath expressions to filter, search, and transform JSON data.
Basic
people[0].name→ the first person's name
Filter
people[?age > `30`]→ people older than 30
Project fields
people[*].name→ all names from the people array
Nested JSON
company.departments[?name=='IT'].employees[*].id→ employee IDs in IT
Wildcard
items[*].details.price→ all prices from items
Tip: use backticks for numbers and single quotes for strings.
About JSON Search (JMESPath)
Query, filter and reshape JSON with JMESPath - the query language used by the AWS CLI and many other tools.
- Paste your JSON into input.json, or click Load Sample.
- Write a JMESPath query such as
people[?age > `30`].name. - Click Search; the result appears in result.json.
- Open the JMESPath query guide for more patterns.
- Numbers go in backticks (
`30`) and strings in single quotes ('IT'). - Projections like
items[*].priceturn an array of objects into an array of values. - Read the JMESPath guide for functions, pipes and multi-select.
Query JSON with JMESPath Online
JMESPath is a query language for JSON: you write a short expression and get back the part of the document you asked for. Use this page to try expressions against your own data before putting them in code or a command line.
JMESPath basics
- Paths:
user.address.citywalks into nested objects;items[0]picks an array element anditems[0:3]a slice. - Projections:
users[*].namereturns thenameof every element. - Filters:
users[?active]orusers[?age > `30`]keep only the matching elements. - Pipes and functions:
users[?active] | length(@)counts results;sort_by(users, &age)sorts them.
Common reasons to use JMESPath
- Testing a
--queryexpression for the AWS CLI - Pulling a few fields out of a large API response
- Filtering log or event data stored as JSON
- Reshaping JSON into a smaller object for another tool
JSON Search FAQ
What is the difference between JMESPath and JSONPath?
Both select parts of a JSON document. JMESPath has a formal specification, built-in functions and can reshape the result; JSONPath starts with $ and has several slightly different dialects. For JSONPath, use the JSONPath Tester.
Why does my query return null?
JMESPath returns null when a path doesn't match, rather than raising an error. Check the spelling and case of each key, and remember that numbers in filters need backticks: `30`, not 30.
How do I write strings and numbers in a filter?
Strings go in single quotes, as in [?dept == 'IT']. Numbers, booleans and null are JSON literals in backticks, as in [?age > `30`].
Is my data uploaded to a server?
No. Queries run entirely in your browser.