Tatu needs to confirm, but i think, you should be able to write and register
your custom JsonSerializer to change the JSON name for the
List<OrganicaMobileEntity>.
More details are available at [1].
~Jakub
[1]
http://wiki.fasterxml.com/JacksonHowToCustomSerializers
On 05/27/2011 03:15 PM, Maxrunner wrote:
> IT does that but using jaxb based instead of jackson gives other issues, for
> example if the list is empty or some property is null, it simply wont
> appear....I just want to chage the name of "List" to some of my own, cant i
> just use an annotation directly in the method:
>
> @GET
> @Produces(MediaType.APPLICATION_JSON)
> @Path("/getAllOrganicas")
> //some annotation here to change the name of "List" type???
> public List<OrganicaMobileEntity> retrieveOrganicas(@Context
> HttpServletRequest req){
>
> List<OrganicaMobileEntity> organicas= new
> ArrayList<OrganicaMobileEntity>();
> //dummy data
>
> organicas.add(fillOrganica(123,req.getParameter("lastUpdate"),"2010-12-23",true));
> organicas.add(fillOrganica(124,"Organica Mind","2000-05-21",false));
> organicas.add(fillOrganica(125,"Organica Strength","2002-12-23",true));
> organicas.add(fillOrganica(126,"Organica Stamina","2011-06-14",true));
> organicas.add(fillOrganica(127,"Organica Luck","2006-02-01",false));
> organicas.add(fillOrganica(128,"Organica Love","2003-04-07", false));
> System.out.println(req.getParameter("lastUpdate"));
>
> return organicas;
> }
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/how-to-rename-XmlRootElement-in-JSON-tp6173292p6411014.html
> Sent from the Jersey mailing list archive at Nabble.com.
>