Created
August 23, 2013 06:49
-
-
Save dmshvetsov/6316254 to your computer and use it in GitHub Desktop.
How to pretty print JSON data with Ruby
source: http://snippets.aktagon.com/snippets/412-how-to-pretty-print-json-data-with-ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat db/seeds/countries.json | ruby -rubygems -e 'require "json";a=JSON.pretty_generate JSON.parse gets;File.open("db/seeds/countries.json", "w"){|f| f << a}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment