JMESPath vs jq
jq is a powerhouse CLI; JMESPath is the lightweight query language built into AWS CLI and SDKs. Here’s how to pick the right tool for each job.
Feature comparison
| Aspect | JMESPath | jq |
|---|---|---|
| Form factor | Embedded query language | Standalone CLI tool |
| CSV output | Needs helper (like this site) | Built-in @csv and @tsv |
| Learning curve | Simple expressions, functions | Powerful but steeper |
| Use in apps | Lightweight library bindings | Usually shell-only |
| Streaming | Not streaming | Supports streaming and large files |
| AWS CLI | Native with --query | Requires piping output to jq |
Which to use?
AWS CLI guide →AWS CLI quick filter
Best: JMESPath
No extra install; use --query directly and export with our CSV tool.
Massive log crunching on server
Best: jq
Streaming and filters excel on huge files.
Application-level JSON transforms
Best: JMESPath
Embed in Python/JS/Go/Java; small dependency footprint.
One-off CLI data wrangling
Best: jq
Rich operators, regex, math, and CSV formatting inline.
Sample commands
JMESPath
aws ec2 describe-instances --query "Reservations[].Instances[].{Id:InstanceId,State:State.Name}" --output json
# Export to CSV with our JMESPath create CSV tooljq
aws ec2 describe-instances \ | jq -r '.Reservations[].Instances[] | [.InstanceId, .State.Name] | @csv' \ > instances.csv