Skip to content

Instantly share code, notes, and snippets.

@EconoBen
Last active June 29, 2025 05:38
Show Gist options
  • Select an option

  • Save EconoBen/d76b41f70c9f5dc10f50ea49a26051ad to your computer and use it in GitHub Desktop.

Select an option

Save EconoBen/d76b41f70c9f5dc10f50ea49a26051ad to your computer and use it in GitHub Desktop.
[workshop] category:shell tags:json,cli,formatting,productivity - Quick JSON Pretty Print
# Using Python (almost always available)
alias jsonpp='python -m json.tool'
# Using jq (more powerful, needs installation)
# brew install jq
alias json='jq .'
# Pretty print with colors
alias jsonc='jq . -C'
# Usage examples:
# curl api.example.com/data | jsonpp
# cat data.json | json
# echo '{"name":"test"}' | jsonc
# Extract specific fields with jq
# cat data.json | jq '.users[].name'
# curl api.example.com | jq '.data.items[] | {id, name}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment