#1474 confirmed
Alexander Sorokin

To_json(:to_json => false) doesn't serialize complex types

Reported by Alexander Sorokin | January 12th, 2011 @ 06:52 PM

When calling to_json(:to_json=>false), I was expecting a hash with primitive types. However, properties and methods are pushed into the hash as is, w/o to_json serialization. To get the true json hash, I'd have to serialize to json and deserialize the data back:

reloaded_json = JSON.load(JSON.dump( json_representation ))

Here's a spec that captures this behavior: https://gist.github.com/777189 .

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Pages