Skip to content

Instantly share code, notes, and snippets.

@kapb14
Forked from phyous/install_simple_pretty_print.sh
Last active June 29, 2017 12:13
Show Gist options
  • Save kapb14/83514ab9f25c9ac2414cdd7b457d456d to your computer and use it in GitHub Desktop.
Save kapb14/83514ab9f25c9ac2414cdd7b457d456d to your computer and use it in GitHub Desktop.
An useful alias to enable simple pretty printing of json data with builtin python module.
# Add alias to bash shell
echo "alias json='python -mjson.tool'" >> ~/.bashrc
# Add alias for zsh shell
echo "alias json='python -mjson.tool'" >> ~/.zshrc
% echo "{\"array\":[1,2,3],\"boolean\":true}" | json
{
"array": [
1,
2,
3
],
"boolean": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment