Pretty-print JSON from the command line or pipe
npm install jfmt-cliPretty-print JSON from the command line. With colors.
``bash`
npm install -g jfmt-cli
`bashFrom a string
json-fmt '{"name":"test","count":42}'
Options
`
-i, --indent Indentation spaces (default: 2)
-c, --compact Compact output (no indentation)
-m, --minify Minify (same as --compact)
--no-color Disable colors
-h, --help Show help
`Examples
`bash
Custom indentation
json-fmt data.json --indent 4Minify
json-fmt data.json --minifyPipe from curl
curl -s https://api.github.com/users/octocat | json-fmtCombine with other tools
cat large.json | json-fmt | head -50
`Colors
Output is colorized when writing to a terminal:
- Keys: cyan
- Strings: green
- Numbers: yellow
- Booleans: magenta
- Null: gray
Use
--no-color` to disable.MIT