Quick Tip
jq is great until you're SSH'd into a minimal container that doesn't have it. Python is already there:
curl -s https://api.github.com/users/octocat | python3 -m json.tool
Add -i to see status + headers inline — invaluable when an API silently 429s you:
curl -si https://api.example.com/data | head -20
Need just one field, no jq? json.tool won't filter, but this one-liner will:
curl -s https://api.github.com/users/octocat | python3 -c "import json,sys; print(json.load(sys.stdin)['public_repos'])"
And the one that saves me weekly — diff two environments' responses:
diff <(curl -s https://staging.api.com/health | python3 -m json.tool --sort-keys) \
<(curl -s https://prod.api.com/health | python3 -m json.tool --sort-keys)
--sort-keys makes the diff stable across key-order changes. Zero installs, works everywhere Python 3 lives.
Powered by MonkeyCode (free tier): https://ly.cyberserval.tech/iIETXiF
What's your go-to stdlib trick that replaces a tool everyone else installs first?
Top comments (0)