JSON nesting

I’m trying to return JSON from a controller method with a certain type
of nesting to satisfy the requirements of a javascript UI component:

This is what I want the JSON to look like

{“page”:“1”,“total”:2,“records”:“13”,“rows”:[{“id”:“13”,“cell”:[“13”,“2007-10-06”,“Client
3”,“1000.00”,“0.00”,“1000.00”,null]},{“id”:“12”,“cell”:[“12”,“2007-10-06”,“Client
2”,“700.00”,“140.00”,“840.00”,null]}

Here is my code but id is showing up at the same level of page and total
rather than being inside of rows (and at the same level as cell)

render :json => {:page => page, :total => total_pages, :records =>
records, :rows => {:id => @account_activities.id, :cell =>
@account_activities} }.to_json

Arshak

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs