title: Rails rendering JSON data with Model Root
body: <p>I've got some data in Rails that I want to render as JSON data. What I'm doing right now is simply finding all instances of a Model and calling render :json=>data.</p>
  
  <pre><code>data = Data.find(:all)
  render :json =&gt; data
  </code></pre>
  
  <p>However, Rails is including the model name in each JSON object. So my JSON data ends up looking like this:</p>
  
  <pre><code>[{modelname:{propertyName: 'value',...}},{modelname:{propertyName: 'value2',...}}]
  </code></pre>
  
  <p>instead of this:
      [{propertyName:'value',...},{propertyName:'value2',...}]</p>
  
  <p>The modelname is always the same and I don't want it to be there. </p>
  
  <p>I changed the option to render the root in the JSON data in one of the Rails initializers but that affects everything that I want rendered as JSON, which I don't want to do for this project.</p>
  
  <p>In this case, I want to be able to do this on a case-by-case basis. </p>
  
  <p>How can I do this? Thanks in advance.</p>