users@jersey.java.net

List marshall

From: Ricardo Borillo <Ricardo.Borillo_at_si.uji.es>
Date: Sat, 18 Sep 2010 13:41:58 +0200

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