[Nitro] Ruby library for serialization

George Moschovitis george.moschovitis at gmail.com
Wed Feb 14 11:35:41 EST 2007


as i demonstrated to_json does not work as expected...

-g.

On 2/14/07, transfire at gmail.com <transfire at gmail.com> wrote:
>
>
> On Feb 14, 9:35 am, "George Moschovitis"
> <george.moschovi... at gmail.com> wrote:
> > Dear devs,
> >
> > is there a Ruby library that can convert a Ruby object to XML, Atom,
> Json
> > etc?
> >
> > I tried facets/more/json and facets/more/xoxo and they just use the
> .to_s
> > method of the object, ie
> >
> > class Article
> >   attr_accessor :title, :content, :author
> >   def to_s; @title; end
> > end
> >
> > a = Article.new
> > a.title = 'hello'
> > a.content = '...'
> > a.author = 'george'
> >
> > a.to_json # => 'hello'
> >
> > which is not what I expected.
> >
> > any suggestions?
>
> The JSON lib has #to_json, the XOXO lib has to_xoxo. There is a a way
> to do XML serialization that's built-into ruby, but it's a little more
> involved and I don't recall off hand how to do so. (Was it via the
> soap lib?) Need to look that up --if you do please let us know.
>
> T.
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>



-- 
http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070214/c1481684/attachment.html 


More information about the Nitro-general mailing list