I’m following this guide – https://github.com/excilys/androidannotations/wiki/Rest%20API and I am trying skip JSON<->POJO conversion and work on pure JSONObject (or gson’s JsonObject). What should I write as an server’s answer?
@Rest("url")
public interface JsonRest
{
@Get("/getjson")
JSONObject getTime();
// or... ?
@Get("/getjson")
ResponseEntity<JSONObject> getTime();
// or... ?
@Get("/getjson")
JsonObject getTime();
}
In all cases I am getting "{}" as a response, but it’s contains correct data after POJO conversion. Which HTTPMessageConverter should I provide?
Thanks for any help.
Simply add GsonHttpMessageConverter to RestTemplate and try this: