json query · jmespath
Pretty-print JSON
Pretty-printing adds whitespace and indentation to JSON for human readability. Most CLI tools (jq, jsonyo) default to 2-space indent.
beginner
jmespath / aws cli
The query
{"name":"voiddo","tools":[{"name":"jsonyo","version":"1.0"}]}
Pass / fail
| Input | Result |
|---|---|
| After pretty-print: { "name": "voiddo", "tools": [ { "name": "jsonyo", "version": "1.0" } ] } | ✓passes |
| Trailing commas (NOT valid JSON, even after format) | ✗fails |
| Single-quoted strings (NOT valid JSON) | ✗fails |
| Comments // or /* */ (NOT valid JSON — JSONC / JSON5 supports them) | ✗fails |
Edge cases & caveats
Pretty-printing changes byte size — files grow ~30-50%. For storage / transport use minified; for editing / review use pretty. Some processors care about key order — pretty-printing doesn't change order, but `--sort-keys` does.
Common use cases
- Reviewing API responses in terminal
- Diff-friendly storage of JSON config
- Debug logging
- Documentation of sample payloads
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
chain expressions with pipes · build a flat list from multiple fields · filter an array by condition · jmespath vs jq: which json query language?