RESTlet sample application does not return Java objects (JSON only)

I looked at the source code available in the official Restlet tutorial .

I am trying to get to the Restlet server using an Android application from a tutorial, and I only get a JSON response, not a Java object. I tried to use all libraries and extensions, nothing works. When I click on the tutorial URL ( http://restlet-example-serialization.appspot.com/contacts/123 ), I get the desired response. Any ideas? BTW, I just use the server (GAE) in the example, not the GWT interface.

+4
source share
1 answer

Use GSOn to convert json to java object. GSON you can get from Google as your code:

http://code.google.com/p/google-gson/

Another way:

Response res = client.handle(req); ObjectRepresentation<Item> obj = new ObjectRepresentation<Item>(res.getEntity()); Item item = obj.getObject(); 
-1
source

All Articles