users@jersey.java.net

Re: [Jersey] How do I marshal nested lists as JSON? I get an array of nulls or an array of one-element dictionaries containing an array.

From: Martin Probst <mail_at_martin-probst.com>
Date: Tue, 21 Jul 2009 09:04:18 +0200

> Just curious here -- what is/was missing from Jackson data binding? I
> assume you checked it out.

I looked at Jackson, but maybe not long enough. It operates through
getters and setters, and it doesn't support objects with real
constructors, does it?

> Personally I think that trying to make XML and JSON serialization
> parts interact (beyond simple things like possibly supporting same
> bean annotations) is largely waste of time -- both can be solved
> rather easily separately, as long as canonical data is viewed to be
> objects. And thereby representations should always derive from the
> primary canonical source; not from secondary rendition.

I absolutely agree. If you look at it from a more theoretical stand
point, JSON is a directed graph where the edges are labelled, XML is
an ordered directed graph where nodes are labelled. There is no way
you can cleanly convert one to the other, and there shouldn't have to
be if you start from objects.

Martin