[Nitro] Ruby library for serialization

transfire at gmail.com transfire at gmail.com
Wed Feb 14 13:14:02 EST 2007



On Feb 14, 11:35 am, "George Moschovitis"
<george.moschovi... at gmail.com> wrote:
> as i demonstrated to_json does not work as expected...

sorry. i didn't read carfully enough. and you are right. to_json only
works with specific types that account for it. but i have a solution.
since YAML is a superset of JSON:

  class Object
    def to_json(*)
      str = to_yaml
      str.sub!(/^---.*?$/, '---')
      YAML.load(str).to_json
    end
  end

I'll make this change to Facets.

(Also fixed to_xoxo, so it will now work too).

Thanks,
T.



More information about the Nitro-general mailing list