Discussion:
Returning JSON without wrapping element?
Chuck Lega
2011-12-17 11:51:04 UTC
Permalink
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

Loading...