Skip to content

Instantly share code, notes, and snippets.

@happyrobots
Created November 3, 2011 02:07
Show Gist options
  • Save happyrobots/1335589 to your computer and use it in GitHub Desktop.
Save happyrobots/1335589 to your computer and use it in GitHub Desktop.
JSON Pretty Generate
require 'JSON'
puts JSON.pretty_generate(JSON.parse('{"array":[1,2,3,{"sample":"hash"}],"foo":"bar"}'))
{
"array": [
1,
2,
3,
{
"sample": "hash"
}
],
"foo": "bar"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment