title: How to return 2 json objects at once?
body: <p>I have a controller returning a json structure like so:</p>
  
  <pre><code>def show
    # .......
    o_json = deep_object_1_to_json(o)
    render :json =&gt; o_json
  end
  
  private
  def deep_object_1_to_json(o)
    o.to_json(
      :include =&gt; {....})
  end
  </code></pre>
  
  <p>Now I need to extend it to return 2 objects. However the obvious solution is giving me problems:</p>
  
  <pre><code>def show
    # .......
    o1_json = deep_object_1_to_json(o)
    o2_json = deep_object_2_to_json(o)
    render :json =&gt; 
    {
           :object_1 =&gt; o1_json,
           :object_2 =&gt; o2_json
    }
  end
  </code></pre>
  
  <p>This returns a json object with 2 strings of escaped json data! </p>
  
  <p>The deep_object_2_to_json functions already have several layers of nested includes so I would rather not have to refactor these into a single function. Is there a way to make this easily extendable to add more objects in the future without the double escaping problem above?</p>
  
  <p>Thanks for any pointers.</p>