Skip to content

Instantly share code, notes, and snippets.

@georgkreimer
Created August 19, 2010 12:44
Show Gist options
  • Save georgkreimer/537794 to your computer and use it in GitHub Desktop.
Save georgkreimer/537794 to your computer and use it in GitHub Desktop.

Revisions

  1. georgkreimer created this gist Aug 19, 2010.
    16 changes: 16 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    require 'json'
    my_json = { :array => [1, 2, 3, { :sample => "hash"} ], :foo => "bar" }
    puts JSON.pretty_generate(my_json)
    Which gets you...

    {
    "array": [
    1,
    2,
    3,
    {
    "sample": "hash"
    }
    ],
    "foo": "bar"
    }