users@jersey.java.net

Re: [Jersey] JAXB JSON Marshalling/Unmarshalling

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Fri, 22 May 2009 11:05:01 +0200

On Fri, May 22, 2009 at 04:54:58PM +0800, Ni Yue wrote:
> Hello everyone,
>
> I am using Jersey to serve JSON request/response and met some issue. Because
> in my xml schema, there're multiple namespaces, and I would like to use
> mapped jettison notation to produce JSON response. But it seems mapped
> notation is always used during marshalling to JSON even if I specified
> mapped jettison configuration in my JAXBContextResolver. How can I make
> Jersey to use different notation during producing JSON response? I found

The mechanism should work fine on the server side. See [1] for an example.
For the client side you need to explicitly register the context resover,
but i suspect, it is not your case, right?

Anyway, without seeing your code, it is hard to say, what is wrong.
Feel free to send me a private e-mail revealing more details, so that
i can help you.

Thanks,

~Jakub

[1]http://download.java.net/maven/2/com/sun/jersey/samples/json-from-jaxb/1.1.0-ea/json-from-jaxb-1.1.0-ea-project.zip

> only when unmarshalling JSON request, different JSON unmarshaller will be
> pickuped according to notation. I am using Jersey 1.0.3. Thanks in advance.
>
> Regards,
> Samuel Ni