Skip to content

Instantly share code, notes, and snippets.

@bitops
Created October 25, 2011 19:44
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 bitops/1313995 to your computer and use it in GitHub Desktop.
Save bitops/1313995 to your computer and use it in GitHub Desktop.
Pretty print JSON - ruby script
#!/usr/bin/env ruby
#
# Put this script in a bin directory and mark it as executable.
# You can now pipe unformatted json files to the script and
# pretty printed json will come out the other end.
#
# Has no external dependencies in Ruby 1.9.x
# Requires the json gem in Ruby 1.8.x
#
require 'json'
jj JSON.parse(STDIN.read)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment