2014-09-10

Pretty json

JSON prettifying is a reccurent topic, every coder needs it to keep some sanity. My way to do it has been something like this for a while:

ruby -rjson -ropen-uri -rawesome_print -e "ap JSON.load(open('http://jsonip.com/'))"
{
       "ip" => "59.115.120.166",
    "about" => "/about",
     "Pro!" => "http://getjsonip.com"
}

because when you are rubyist everything can be solve with ruby, obviously.

But well, then one day I did

pip install pjson

and then

curl -s http://jsonip.com | pjson
{
  "Pro!": "http://getjsonip.com",
  "about": "/about",
  "ip": "59.115.120.166"
}

Faster, easier, happier.

comments powered by Disqus