Hi everybody,

I search a conveniant way to format an object list sended by my ejb restfull
API (work with TomEE+ 1.7.4). I would like to remove the enclosing objet
that contain my list; eg:

{
  "tiers": [
    {
      "id": 1006384,
      "value": 12
    },
    {
      "id": 1006385,
      "value": 11
    }
 ]
}

What I would want :

[
    {
      "id": 1006384,
      "value": 12
    },
    {
      "id": 1006385,
      "value": 11
    }
 ]


My ejb code is like this:
    @Path("/")
    @GET
    public Response list(@QueryParam("offset") @DefaultValue("0") final int
offset, @QueryParam("limit") @DefaultValue("20") final int limit) {
        final TypedQuery<Tiers> query = em.createNamedQuery(Tiers.FIND_ALL,
Tiers.class);
        query.setFirstResult(offset);
        query.setMaxResults(limit);
        return Response.ok(new
GenericEntity<Collection&lt;Tiers>>(query.getResultList()){}).build();
    }


Best regards,



--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/ejb-restful-Customize-JSON-XML-generation-tp4679564.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to