users@jersey.java.net

Re: [Jersey] List marshall

From: Ángel Eduardo <egarcia_at_swissms.ch>
Date: Sat, 18 Sep 2010 14:00:36 +0200

  Don't know if this helps, but in that case, I always use a:

public JsonArray getExamples()
{
}

...using JsonArray from Jettison, but of course that means you have to
create a JsonArray object instead of a list, so your mileage may vary :)
I'm sure the gurus at this list will have a better response :)

--
Ángel Eduardo
On 18/09/2010 13:41, Ricardo Borillo wrote:
> Hi all,
>
> I'm sure this is a simple JAXB question, but i can't manage to make it work ...
>
> I have a method like this:
>
>      @GET
>      @Path("xxx")
>      @Produces(MediaType.APPLICATION_JSON)
>      public List<Example>  getExamples()
>      {
>          List<Example>  exampleList =  ... some source ...
>
>          return exampleList;
>      }
>
> And with this method, i can get:
>
> {"Example":[{"attr1":"1","attr2":"2"},{"attr1":"a","attr2":"b"},{"attr1":"xx","attr2":"yy"}]}
>
> Fine. But, how can i get only the list of attributes without the name
> of the XmlRoot of the class example? Something like this:
>
> [{"attr1":"1","attr2":"2"},{"attr1":"a","attr2":"b"},{"attr1":"xx","attr2":"yy"}]
>
> Thanks in advance :)
>
> ---
> Salut,
> ====================================
> Ricardo Borillo Domenech
> http://xml-utils.com
> twitter: @borillo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>