Reputation: 1934
I am trying to convert the following json index from the following style
[{"event":{"title":"test"}},{"event":{"title":"test2"}}]
but instead of having it this way i am wondering if its possible to create the index json action as the following json structure
{"event": [ { "title":"test"},{ "title":"test2" }] }
I can generate the first style by the following code
respond_with @events.as_json(:root => true, :only => [:title])
But not sure how to have rails to generate json index structure has the second format
Upvotes: 0
Views: 86