json query · jmespath
JMESPath vs jq
JMESPath is declarative + AWS-native (used by `aws --query`). jq is pipe-based + Linux/UNIX-feeling. Both query JSON; pick based on toolchain integration.
intermediate
jmespath / aws cli
The query
JMESPath: users[?age > `18`].name jq: .users | map(select(.age > 18)) | .[].name
Pass / fail
| Input | Result |
|---|---|
| Both produce: ["Ada", "Bo"] | ✓passes |
| JMESPath does NOT support: assignment, control flow, custom functions | ✗fails |
| jq does NOT have: native AWS CLI integration, multiselect-hash syntax | ✗fails |
Edge cases & caveats
JMESPath is preferred when: (1) you're already in AWS / Azure CLI ecosystem (their --query uses it), (2) you need predictable, declarative queries. jq is preferred when: (1) you're piping multiple steps, (2) you need full programming constructs, (3) you've installed it on the system.
Common use cases
- Choosing tool for new project
- Migrating between tools
- Understanding AWS CLI --query syntax
- Cross-platform JSON pipelines
Run JMESPath against piped JSON
jsonyo is the CLI twin of the jsonyo browser extension — validate against schemas, format, run JMESPath queries against piped JSON. Zero deps.
Open jsonyo
Related
pretty-print json (formatted output) · chain expressions with pipes · build a flat list from multiple fields · filter an array by condition · ↗ JSON in CORS-protected APIs