users@jersey.java.net

[Jersey] Re: JSON serialization to object lists instead of array

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Mon, 11 Jul 2011 14:49:07 -0700

On Sun, Jul 10, 2011 at 3:51 AM, Michael Justin <michael.justin_at_gmx.net> wrote:
> Is it possible to configure the JSON representation in Jersey to generate
> object lists instead of arrays like in this example? (found [here][1])

Simplest way would to just add intermediate wrapper objects there;

public List<AWrapper> accomodations;

public class AWrapper {
  public Accomodation accomodation;
}

public class Accomodation {
  ....
}

or, perhaps consider just not adding that unnecessary 'accomodation'
level in there. Is there specific reason why it is to be added there?
It seems to add little value.

-+ Tatu +-