I have a service like this:
@Path("/test")
public class TestEndPoint {
@GET
@Produces("application/json")
public Response get(){
POJO pojo = new POJO();
pojo.setName("Rafael");
return Response.ok(pojo).build();
}
}
and works perfectly
but with JSONObject, it does not work
@Path("/test")
public class TestEndPoint {
@GET
@Produces("application/json")
public Response get(){
org.json.JSONObject json = new org.json.JSONObject();
json.put("name", "Rafael");
return Response.ok(json).build();
}
}
I use JBossAS 7.1 with Jackson provider.
ps - I have a web service with JERSEY and it works fine with JSONObject, but with RESTEASY it does not. I need to do .toString so that it can generate the answer without exception.