users@jersey.java.net

[Jersey] Re: Question about natural notation

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Fri, 18 Mar 2011 12:01:38 +0100

Hi Noah,

It really depends on what you are trying to serialize out.
i.e. for public class Wrapper{ List<String> fooList = new List<String>();},
and that is IIUC what you have, Jackson should generate
just what you want: { "fooList":[]}

But maybe i get it wrong, could you please provide an example?

~Jakub

On 03/15/2011 08:37 PM, NBW 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!
>
> -Noah
>