pretty print json

Pretty Print JSON

How to pretty print json from the command line?

$ echo '{"foo": "lorem", "bar": "ipsum"}' | python -mjson.tool
{
    "bar": "ipsum", 
    "foo": "lorem"
}

$ python -mjson.tool < /tmp/input.json 
{
    "bar": "ipsum", 
    "foo": "lorem"
}

$ curl http://rene.f0o.com/~rene/json_example.json | python -mjson.tool
{
    "bar": "ipsum", 
    "foo": "lorem"
}


Comments

Brandon Rhodes said…
Wow, this is neat! Thanks!

Popular posts from this blog

Draft 3 of, ^Let's write a unit test!^

Is PostgreSQL good enough?

post modern C tooling - draft 6