users@jersey.java.net

Re: [Jersey] dynamic JAXB marshalling

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 04 Jan 2010 10:22:18 +0100

On Dec 30, 2009, at 9:52 PM, FSauer_at_dsthealthsolutions.com wrote:

>
> I have a resource class that contains a dynamic collection of name
> value pairs but I want to marshall it to XML/JSON as if it had true
> properties by those names.
> How do I break into the JAXB marshalling to make that happen?
> What kind of @Provider magic can I use to customize the marshallimng
> of just this one class?
>

I do not think you can customize JAXB in this respect because it
derives the element/attribute names from annotations or via reflection.

I strongly suspect you will need to write your own provider classes to
serialize out the XML or JSON of the dynamic collections.

For Jackson see:

   http://wiki.fasterxml.com/JacksonInFiveMinutes#Simple_Data_Binding_Example

Paul.