title: Ruby JSON.pretty_generate ... is pretty unpretty
body: <p>I can't seem to get <code>JSON.pretty_generate()</code> to actually generate pretty output in Rails.</p>
  
  <p>I'm using Rails 2.3.5 and it seems to automatically load the JSON gem.  Awesome.  While using <code>script/console</code> this does indeed produce JSON:</p>
  
  <pre><code>some_data = {'foo' =&gt; 1, 'bar' =&gt; 20, 'cow' =&gt; [1, 2, 3, 4], 'moo' =&gt; {'dog' =&gt; 'woof', 'cat' =&gt; 'meow'}}
  some_data.to_json
  =&gt; "{\"cow\":[1,2,3,4],\"moo\":{\"cat\":\"meow\",\"dog\":\"woof\"},\"foo\":1,\"bar\":20}"
  </code></pre>
  
  <p>But this doesn't produce <em>pretty output</em>:</p>
  
  <pre><code>JSON.pretty_generate(some_data)
  =&gt; "{\"cow\":[1,2,3,4],\"moo\":{\"cat\":\"meow\",\"dog\":\"woof\"},\"foo\":1,\"bar\":20}"
  </code></pre>
  
  <p>The only way I've found to generate it is to use <code>irb</code> and to load the "Pure" version:</p>
  
  <pre><code>require 'rubygems'
  require 'json/pure'
  some_data = {'foo' =&gt; 1, 'bar' =&gt; 20, 'cow' =&gt; [1, 2, 3, 4], 'moo' =&gt; {'dog' =&gt; 'woof', 'cat' =&gt; 'meow'}}
  JSON.pretty_generate(some_data)
  =&gt; "{\n  \"cow\": [\n    1,\n    2,\n    3,\n    4\n  ],\n  \"moo\": {\n    \"cat\": \"meow\",\n    \"dog\": \"woof\"\n  },\n  \"foo\": 1,\n  \"bar\": 20\n}"
  </code></pre>
  
  <p>BUT, what I really want is Rails to produce this.  Does anyone have any tips why I can't get the generator in Rails to work correctly?</p>
  
  <p>Thanks!</p>