The output of a List method is too verbose. An example:
@XmlRootElement
public class TestA {
private String str;
public TestA() {
}
}
@GET
@Path("list")
@Produces(MediaType.APPLICATION_JSON)
public List<TestA> testListFormat() {
List<TestA> l = new ArrayList<TestA>(3);
l.add(new TestA("a"));
l.add(new TestA("b"));
l.add(new TestA("c"));
List<JSONObject> jl = new ArrayList<JSONObject>(3);
for (TestA a : l)
JSONArray jsa = new JSONArray(jl);
log.info(jsa.toString());
return l;
}
RESTeasy output format:
[{"testA":{"str":"a"}},{"testA":{"str":"b"}},{"testA":{"str":"c"}}]
JSONObject output format:
[
,
{"str":"b"},
{"str":"c"}]