title: Rails3: Take control over generated JSON (to_json with datamapper ORM)
body: <p>From my Rails 3 app i want a JSON like this:
      {count:10,
       pictures:[
                  {id:1},
       ... ] }
  I tried</p>
  
  <pre><code>render( :json =&gt; { :count =&gt; 10, :pictures =&gt; @pictures.to_json(:only=&gt;:id) } )
  </code></pre>
  
  <p>but in this case, my pictures get escaped </p>
  
  <pre><code>..."pictures":"[{\"id\":2653299}, ....
  </code></pre>
  
  <p>In my old merb app I had the following simple line in my controller:</p>
  
  <pre><code>    display( { :count=&gt;@count, :pictures =&gt; @pictures } ) 
  </code></pre>
  
  <p>Because I am using <code>datamapper</code> as my ORM and <code>dm-serializer</code> I am not sure where to influence the generated json.</p>