title: Rails - Building a JSON object with multiple items
body: <p>currently I am creating a JSON object as follows:</p>
  
  <pre><code>@comments = Array.new
  
  comments.collect do |comment|
    @comments &lt;&lt; {
      :id =&gt; comment.id,
      :content =&gt; html_format(comment.content),
      :created_at =&gt; comment.created_at
    }
  end
  
  @comments.to_json
  </code></pre>
  
  <p>And this returns something like this:</p>
  
  <pre><code>[{"created_at":"2011-03-02T09:17:27-08:00","content":"&lt;p&gt;Random.......&lt;/p&gt;","id":734}, {"created_at":"2011-03-02T09:17:27-08:00","content":"&lt;p&gt;asdasd.......&lt;/p&gt;","id":714}, {"created_at":"2011-03-01T09:17:27-08:00","content":"&lt;p&gt;Random.......&lt;/p&gt;","id":134}, {"created_at":"2011-03-01T02:17:27-08:00","content":"&lt;p&gt;dasdasdasdasd.......&lt;/p&gt;","id":3124}]
  </code></pre>
  
  <p>Problem here is that I need to include a few other items that aren't arrays. What I would like is the JSON object to look something like this:</p>
  
  <pre><code>[comments: {"created_at":"2011-03-02T09:17:27-08:00","content":"&lt;p&gt;Random.......&lt;/p&gt;","id":734}, {"created_at":"2011-03-02T09:17:27-08:00","content":"&lt;p&gt;asdasd.......&lt;/p&gt;","id":714}, {"created_at":"2011-03-01T09:17:27-08:00","content":"&lt;p&gt;Random.......&lt;/p&gt;","id":134}, {"created_at":"2011-03-01T02:17:27-08:00","content":"&lt;p&gt;dasdasdasdasd.......&lt;/p&gt;","id":3124}, last_load: "123123123123", last_view: "zxczcxzxczxc"]
  </code></pre>
  
  <p>Any ideas on how I can take what I have above, and expand it to pass additional items other than the comments array?</p>
  
  <p>Thank you!</p>