Skip to content

Instantly share code, notes, and snippets.

@niku
Created December 9, 2013 07:16
Show Gist options
  • Save niku/7868495 to your computer and use it in GitHub Desktop.
Save niku/7868495 to your computer and use it in GitHub Desktop.
require 'json'
obj = {
foo: 'bar',
hoge: [
'fuga',
{
one: 1,
two: 2
}
]
} print JSON.pretty_generate(obj)
# > PRECISE64 niku% ruby generate_json.rb
# > {
# > "foo": "bar",
# > "hoge": [
# > "fuga",
# > {
# > "one": 1,
# > "two": 2
# > }
# > ]
# > }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment