users@jersey.java.net

Re: [Jersey] List marshall

From: Ricardo Borillo <Ricardo.Borillo_at_si.uji.es>
Date: Sun, 19 Sep 2010 17:11:41 +0200

Hi Angel,

Thanks for your response, but if it's possible i prefer not to user directly
JSON classes and work with JAXB ...

---
Salut,
====================================
Ricardo Borillo Domenech
http://xml-utils.com / http://twitter.com/borillo
2010/9/18 Ángel Eduardo <egarcia_at_swissms.ch>:
> 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
>
>
>