Last active
August 29, 2015 14:15
-
-
Save wolfgangmeyers/7a113d313371db6e07b9 to your computer and use it in GitHub Desktop.
Format json data on the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pipe any json into the command to the right of the pipe to format any valid json payload | |
echo '{"foo": "bar"}' | python -c "import sys, json;print json.dumps(json.loads(sys.stdin.read()), indent=4)" | |
# use the built-in tool to do the exact same thing | |
echo '{"foo": "bar"}' | python -m json.tool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment