Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

to_json <> to_xml (dasherize => true, methods => other_ids)

#1576

I've been developing a Rails application, the sole purpose of which is to act as a REST API, sending and receiving JSON or XML.

Along the way, numerous discrepancies between to_json and to_xml have popped up which have proved to be a royal pain in the arse:

  1. to_xml misrepresents the other_ids result (included using the 'methods' option) as a concatenated string, when it should in fact be an array of ids. to_json gets this right.

  2. to_xml accepts the dasherize => true option. to_json does not.

I'm not yet familiar enough with the Rails source to provide an acceptable patch, but I would like to contribute in so far as at least providing this feedback.

Reported by ronin-24025 (at lighthouseapp) · December 15th, 2008 @ 12:30 PM

State: invalid
Milestone: 2.x
Assigned to: Frederick Cheung Frederick Cheung
Importance: none

Activity

  1. Frederick Cheung
    Frederick Cheung

    Is dasherize useful for json ? I can't think you would ever want that since it means that you have to access things as x['foo-bar'] since x.foo-bar is obviously invalid (or rather doesn't mean x['foo-bar'])

    If you're interested in playing around the appropriate files are active_record/lib/serialization.rb, active_record/lib/serializers/json_serializer.rb, active_record/lib/serializers/xml_serializer.rb

    December 23rd, 2008 @ 11:02 AM

  2. Pratik
    Pratik
    • State changed from new to invalid
    • Assigned user set to Frederick Cheung

    March 13th, 2009 @ 02:45 PM