title: Rails Array to JSON
body: <p>I have a rails array that is being populated from items in the database based on parameters from the query string. I then want to make that array into JSON to work the jquery full calendar plugin but i can't seem to get it to work.</p>
  
  <p>Im am outputting json but its surrounded by [] and i don't know if this is what is stopping the calendar events from showing up in the jquery full calendar plugin.</p>
  
  <pre><code>def get_sessions
    @sessions = Session.find(:all, :conditions =&gt; ["starttime &gt;= '#{Time.at(params['start'].to_i).to_formatted_s(:db)}' and endtime &lt;= '#{Time.at(params['end'].to_i).to_formatted_s(:db)}'"] )
    sessions = [] 
    @sessions.each do |session|
      sessions &lt;&lt; {:id =&gt; session.id, :title =&gt; session.client.to_s, :session_num =&gt; session.session_num, :start =&gt; "#{session.starttime.iso8601}", :end =&gt; "#{session.endtime.iso8601}"}
    end
    render :json =&gt; sessions
  end
  </code></pre>
  
  <p>This code is originally from the <a href="http://vinsol.com/blog/2010/03/29/jquery-full-calendar-with-rails/" rel="nofollow">http://vinsol.com/blog/2010/03/29/jquery-full-calendar-with-rails/</a> rails 2 app but im trying to build it with rails 3.</p>
  
  <p>Any help would be really appreciated.</p>
  
  <p>Thanks</p>