# Outputting strict JSON

**URL:** <https://www.ruby-forum.com/t/outputting-strict-json/167449>\
**Category:** Rails\
**Created:** [May 7, 2009, 9:38pm UTC](https://www.ruby-forum.com/t/outputting-strict-json/167449 "2009-05-07T21:38:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [May 7, 2009, 9:38pm UTC](https://www.ruby-forum.com/t/outputting-strict-json/167449/1 "2009-05-07T21:38:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [May 7, 2009, 10:00pm UTC](https://www.ruby-forum.com/t/outputting-strict-json/167449/2 "2009-05-07T22:00:19Z")

</div>

On 7 May 2009, at 12:37, lyntaff [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [May 7, 2009, 10:13pm UTC](https://www.ruby-forum.com/t/outputting-strict-json/167449/3 "2009-05-07T22:13:18Z")

</div>

Thanks, That worked great.

On May 7, 8:59 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
