Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmaxwell/67e77f213090b838776eea557e712cf9 to your computer and use it in GitHub Desktop.
Save johnmaxwell/67e77f213090b838776eea557e712cf9 to your computer and use it in GitHub Desktop.
Curl some JSON and then print it out all pretty-like
curl "http://jsonip.com" | ruby -e "require 'json'; puts JSON.pretty_generate(JSON.parse(STDIN.gets))"
# {
# "ip": "....",
# "about": "/about",
# "Pro!": "http://getjsonip.com"
# }
# Here's one that copies it straight into your clipboard (on the Mac)
curl "http://jsonip.com" | ruby -e "require 'json'; puts JSON.pretty_generate(JSON.parse(STDIN.gets))" | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment