You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Wong <up...@yahoo.com> on 2010/12/14 03:26:19 UTC
JAX-RS Array Serialization Issues
Hi,
I ran into the problem listed at:
http://cxf.apache.org/docs/jax-rs.html#JAX-RS-DealingwithJSONarrayserializationissues
Is it necessary to set the arrayKeys list for the this to work? Can I get all
lists of size 1 to serialize properly?
Thanks,
-Robert
Re: JAX-RS Array Serialization Issues
Posted by Daniel Kulp <dk...@apache.org>.
On Monday 13 December 2010 9:26:19 pm Wong wrote:
> Hi,
>
> I ran into the problem listed at:
> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-DealingwithJSONarrayserializa
> tionissues
>
> Is it necessary to set the arrayKeys list for the this to work?
Yes.
> Can I get
> all lists of size 1 to serialize properly?
Not without the arrayKeys set. The basic reason is that we just feed the
JAXB marshaller an XMLStreamWriter that happens to output JSON. The writers
have no idea what they are writing. They just get events like startElement
and such. For any given startElement, it needs to know if it should output
it as a json array or not. It's not something JAXB provides to the writer.
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog