Friday, August 31, 2018

Pretty print JSON from command line

echo '{ "element0" : "hi", "element1" : "there" }' | python -m json.tool
prints:
{
    "element0": "hi",
    "element1": "there"
}
You can also cat a JSON file and pipe to the same command

No comments:

Post a Comment