users@jersey.java.net

[Jersey] Re: Unmarshalling JSON nulls?

From: Mike Summers <msummers57_at_gmail.com>
Date: Tue, 20 Nov 2012 19:14:58 -0600

Correct, this particular application requires the use of JAXB annotations,
it cannot work with just POJO mapping.

So the question stands, is there a way to control Jersey's unmarshalling
behavior when the target objects are JAXB annotated and POJOMapping is
false? In particular, why are in-coming JSON nulls not mapped to Java null?

On Tue, Nov 20, 2012 at 6:28 PM, Tatu Saloranta <tsaloranta_at_gmail.com>wrote:

> On Tue, Nov 20, 2012 at 3:22 PM, Mike Summers <msummers57_at_gmail.com>
> wrote:
> > Not using POJO mapping, using JAXB, Jersey appears to have a set of
> > predetermined default values for JSON nulls while unmarshalling via JAXB:
> > String => "", Integer => 0, ... is there anyway to easily control these
> > values either with configuration or annotations?
> >
> > Using Jersey's POJO mapping I get what I want, which is to map JSON null
> to
> > Java null, but for other reasons we really need to use JAXB.
>
> POJO mapping can use JAXB annotations (and does so by default, I
> think), if that's what you mean by "need to use JAXB"? JAXB itself is
> an XML framework, and does not produce JSON. Although some
> implementations (Moxy) have extensions that allow producing special
> kind of xml-like JSON.
>
> -+ Tatu +-
>