I use RESTEasy to return Java objects as JSON objects (which use the Jettison Mapped protocol for JSON marshelling).
But I do not want it to return the root of the node.
for instance
@XmlRootElement public class Car{ private Integer id; private String name; }
An object of this class will result in JSON:
{"Car":{"id":6,"name":"someName"}}
Because it really comes from
<Car> <id>6</id> <name>someName</name> </Car>
But I do not want root node. I just want to:
{"id":6,"name":"someName"}
So that I can use it with client libraries like Backbone.js
Is there any way (some kind of annotation) to force this on JSON Marshalling?
Sam,
source share