In short: I can do following:
user.to_xml(:root => “xml_user” )
But not following:
user.to_json(:root => “json_user”)
JSON serializer for AR doesn’t allow us to specify “root” option
unlike XML serializer. JSON serializer always uses model name as
the root if class attribute include_root_in_json is set to
I’ve added a patch which allows JSON serializer to accepts custom root option.
Let me know what you think about the patch.