title: Rails JSON conversion error
body: <p>I'm getting a strange error when trying to convert my object to json for an API connection. The following details my experience.</p>
  
  <p>If I call</p>
  
  <pre><code>JSON.generate(self)
  </code></pre>
  
  <p>the output is</p>
  
  <pre><code>{"validation_context":null,"errors":{},"params":{"number":"123","name":"test"}}
  </code></pre>
  
  <p>I only need the params in my json object and when I call</p>
  
  <pre><code>JSON.generate(self.params) # or the next line
  JSON.generate(@params) #params has been set on the object as an accessor
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>undefined method `merge' for #&lt;JSON::Ext::Generator::State:0x1043f1a38&gt;
  </code></pre>
  
  <p>For some reason <code>params</code> is not considered a Hash. It serializes ok when I'm getting the parent object but fails otherwise. How can I serialize just the params?</p>