Skip to content

Instantly share code, notes, and snippets.

@k0001
Created October 28, 2010 11:29
Show Gist options
  • Save k0001/651160 to your computer and use it in GitHub Desktop.
Save k0001/651160 to your computer and use it in GitHub Desktop.
jsonindent
cat <<EOF | sudo tee /usr/bin/jsonindent > /dev/null
#!/usr/bin/env python
import sys
import json
json.dump(json.load(sys.stdin), sys.stdout, indent=1)
sys.stdout.write('\n')
EOF
sudo chmod 0755 /usr/bin/jsonindent
# example usage
% echo '{"hello": "world"}' | jsonindent
{
"hello": "world"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment