Skip to content

Instantly share code, notes, and snippets.

@diegogslomp
Created December 14, 2015 17:50
Show Gist options
  • Save diegogslomp/013c4220f67eb7008988 to your computer and use it in GitHub Desktop.
Save diegogslomp/013c4220f67eb7008988 to your computer and use it in GitHub Desktop.
Simple bash script to pretty-print json files with json.tool python module
#!/bin/bash
set -e
if [[ "$#" -eq 1 ]] && [[ -r "$1" ]]; then
while IFS='' read -r line || [[ -n "$line" ]]; do
echo "$line" | python -m json.tool
done < "$1"
else
echo "jsonview.sh"
echo "Usage: jsonview.sh <jsonfile>"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment