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.
Lyn W. (Guest)
on 2009-05-07 23: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.
Frederick C. (Guest)
on 2009-05-08 00:00
(Received via mailing list)
On 7 May 2009, at 12:37, lyntaff <removed_email_address@domain.invalid> 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
Lyn W. (Guest)
on 2009-05-08 00:13
(Received via mailing list)
Thanks, That worked great.

On May 7, 8:59 pm, Frederick C. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.