An extremely simple tool for pretty printing JSON in a shell
# after installation, you can pipe JSON:
echo '{"one": {"two": {"three": "nesting"} } }' | pretty-json
Output:
{
"one": {
"two": {
"three": "nesting"
}
}
}
# Note: requires node is installed
# clone this repo or copy the file "pretty-json" to your machine
git clone https://github.com/BirdHighway/pretty.git
# make the file executable
chmod +x pretty-json
# copy the file "pretty-json" to a directory in your $PATH
# some directories will require this copy command be run with sudo
cp pretty-json ~/bin
# optional: rename the command to something shorter
mv ~/bin/pretty-json ~/bin/pj
# not sure which directories are in your $PATH?
chmod u+x show-my-path.sh
./show-my-path.sh
# grab script with curl, save to path, modify to make executable
sudo curl --silent -o /usr/bin/pretty-json https://raw.githubusercontent.com/BirdHighway/pretty/main/pretty-json && sudo chmod +x /usr/bin/pretty-json