The actual problem
Every developer I know runs the same loop several times a day:
curl https://api.example.com/some-endpoint
The response comes back as one minified line of JSON. You squint, scroll, give up, and reach for a formatter.
I have ended up using three different formatters for this depending on the situation. None of these are novel — the interesting part is the picking. Below is the boring rule of thumb I actually follow, and the redaction step most posts about this skip entirely.
Approach 1: pipe through jq
This is the default and almost always the right answer:
curl -s https://api.example.com/users | jq .
- ✅ Fastest path to pretty output
- ✅ Tells you where the parse fails with a column reference
- ✅ Composable with filtering:
jq '.users[] | select(.active)'
- ❌ Requires
jqto be installed (not guaranteed on minimal containers or fresh CI) - ❌ The filter mini-language has a learning curve
When to not reach for jq first: when you only need to read the response and you are already about to paste it somewhere else (a Slack thread, a GitHub issue, a ticket). At that point you are leaving the terminal anyway and the savings are marginal.
Approach 2: Python json.tool as a fallback
When jq is inconvenient to install — locked-down CI runners, remote SSH on a server you do not own, minimal Alpine images where you happen to have Python but not jq — the stdlib has you covered:
curl -s https://api.example.com/users | python3 -m json.tool
- ✅ Often available where installing
jqis inconvenient - ✅ Sufficient for pretty printing + parse validation
- ❌ Error messages are less precise than
jqon truncated input - ❌ No filter / select capability — it formats, that's it
I use this maybe twice a week. It is the "good enough" tool, not the "right" tool. Note that Python is not actually guaranteed either — distroless images and BusyBox containers ship with neither.
Approach 3: a browser-side formatter for the share step
I only paste curl output into a browser formatter when I am about to share the result with a teammate (Slack, GitHub issue, ticket review), and the payload is safe for that audience.
The reason that condition matters: a security firm disclosed last year that two popular online formatters had been retaining 80,000+ saved snippets, including AWS keys and JWTs. I covered the story separately in . It is a static site with no /api/* routes, the parser core is open source (
If you have a redaction recipe better than the walk(...) filter above — especially for nested envelopes from common API frameworks (Laravel, Rails, NestJS, Spring) — I would like to read it.
SOCIAL SHARE CARD GENERATOR