I would like to switch from Xstream to Jackson for serializing/deserializing
objects in a Restlet server.
If i use Xstream libraries for:
@Get("json")
public Profile retrieve() {
Profile prf = new Profile (...);
...
return prf;
}
i would get a JSON like:
{"Profile":{"id": 1, "name": "jack" ... }}
while with Jackson i get only:
{"id": 1, "name": "jack" ... }
How can i get the same JSON with Jackson? i would need this for KVC objects in
my client (otherwise i need to specify the mappings manually)
I have the same issue if i return an ArrayList< Profile > , jackson doesn't
wrap the list of Profiles when serialized and the JSON instead of
{Profile:[{firstProfile}, {secondProfile}]}
it looks like:
[{firstProfile}, {secondProfile}]
i've also been also trying to use Jackson annotations:
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT)
public class MyProfileServerResource extends ServerResource {
but it seems it's not interpreted by restlet, any ideas?
thanks!!
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2909458