In retrofit to map json response to pojo usually we do this
@POST
Call getDataFromServer(@Url String url, @Body HashMap ha
Use standard generics, with a little bit of hacking around
Define your interface like this
public interface ApiCalls {
@POST
Call getResult getDataFromServer(@Url String url, @Body HashMap hashMap);
}
and call for creating api client use a helper method
class HelperMethods {
@SuppressWarnings("unchecked")
private static ApiCalls getClient() {
return retrofit.create((Class>)(Class>)ApiCalls.class);
}
}
ApiCalls api = HelperMethods.getClient();
But despite of the fact how many times it has been said here, I am gonna say it again... Don't do this .. You are giving up the whole type safety and contract validation that Retrofit is offering .. That is actually the most exciting thing about it..