users@jersey.java.net

[Jersey] Returning JSON without wrapping element?

From: Chuck Lega <chuck.lega_at_gmail.com>
Date: Sat, 17 Dec 2011 12:51:04 +0100

Hi,

Not sure if this is the proper place to post this, but I give it a shot ...
I have created a small REST service using Jersey, running on appengine. To
return data as json I use JAXB annotations.
Returning a single entity works just fine, ie: Person -> {"name" : "alice"}
but when returning a list of Persons, I get: { "persons" : [{"name :
"alice"}, {"name : "bob"}] }
i.e. an object with a property containing a lst of persons. I would rather
have just: [{"name : "alice"}, {"name : "bob"}]

Am I doing something wrong or is it supposed to work like this? Is there
anyway to make it work the way I want?

/Chuck