Forum: Ruby on Rails Outputting strict JSON

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B455036ffc83a268f77a7561f20a7ab6?d=identicon&s=25 Lyn Williams (lyntaff)
on 2009-05-07 21:38
(Received via mailing list)
Does any body know how I can output JSON so that instead of getting:

{booking: {id: 1, name: "foo"}


You get this instead:

{id: 1, name: "foo"}

Can't find a solution for this at all

Thank you for any help.
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-05-07 22:00
(Received via mailing list)
On 7 May 2009, at 12:37, lyntaff <lyn@opaldesign.co.uk> wrote:

>
> Does any body know how I can output JSON so that instead of getting:
>
> {booking: {id: 1, name: "foo"}
>
>

There should be an initializer in your app called something like
new_rails_defaults.rb that shows you how to control this
B455036ffc83a268f77a7561f20a7ab6?d=identicon&s=25 Lyn Williams (lyntaff)
on 2009-05-07 22:13
(Received via mailing list)
Thanks, That worked great.

On May 7, 8:59 pm, Frederick Cheung <frederick.che...@gmail.com>
This topic is locked and can not be replied to.