json query · jmespath
Minify JSON for size
Strip all unnecessary whitespace from JSON for transport / storage. 30-50% size reduction typical. The output is still valid JSON; receivers parse identically.
beginner
jmespath / aws cli
The query
{
"name": "voiddo",
"items": [
{"id": 1},
{"id": 2}
]
}
Pass / fail
| Input | Result |
|---|---|
| After minify: {"name":"voiddo","items":[{"id":1},{"id":2}]} | ✓passes |
| Bytes: 100 → 48 (52% reduction) | ✓passes |
| Removing whitespace inside string values (corrupts data) | ✗fails |
| Removing escape sequences (corrupts data) | ✗fails |
Edge cases & caveats
Minification only removes whitespace OUTSIDE string values. Whitespace inside strings is preserved. Tools sometimes also drop trailing newline — be aware if downstream tooling requires one.
Common use cases
- API response size optimization
- Reducing JSON in HTTP request bodies
- Storage cost reduction (S3, etc.)
- Edge / mobile delivery
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
build a flat list from multiple fields · filter an array by condition · jmespath vs jq: which json query language? · built-in functions cheatsheet