Last active
June 29, 2025 05:38
-
-
Save EconoBen/d76b41f70c9f5dc10f50ea49a26051ad to your computer and use it in GitHub Desktop.
[workshop] category:shell tags:json,cli,formatting,productivity - Quick JSON Pretty Print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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