users@jersey.java.net

[Jersey] Re: Question about natural notation

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Tue, 15 Mar 2011 13:30:09 -0700

On Tue, Mar 15, 2011 at 12:37 PM, NBW <emailnbw_at_gmail.com> wrote:
> I'm experimenting with using JAXBContextResolver and I have a
> JSONConfiguration.natural().rootUnwrapping(false) setting for my context.
> Things look good but one thing that isn't formatting just right for my needs
> is the case where a property is a List and the list has 0 elements. Right
> now it is left out of the JSON response. What I would like is to include it
> with the root element wrapped like so:
> "fooList":[]
> That is the behavior I am seeing with Jackson POJO support, however, I can't
> find a way to turn off rootUnwrapping in general with that or I would go
> that route. Thanks!

With Jackson POJO support, there should not be wrapping by default.
With 1.7 you can enable wrapping (but there is no support for
unwrapping, yet). So if you see wrapper value, it is an indication
that perhaps pojo style is not enabled?

-+ Tatu +-