I have this responsebody
{
"status":"OK",
"payload":{}
}
where payload is generic (a java-representation would look like this)
There was the converter stuff for Retrofit1, but Retrofit2 doesn't seem to allow you to do that generically, only type-specific, which is not an option, when you have 70+ different response-bodies.
Edit:
Since there seems to be confusion here, I'm not looking to convert json-strings into objects.
When I get the aforementioned ResponseBody, I want to be able to write the following in my Retrofit-interface
@POST("someAddress")
SomeResponse getData();
instead of
@POST("someAddress")
ResponseWrapper<SomeResponse> getData();
There are TypeAdapters for Gson that can do that for definitive types (as in "I have a class Animal
and need GSON to deserialize it correctly to Dog
, Cat
and Orangutan
), but NOT for generic types (which is what I would need with my generic payload.
I could register a typeadapter for every possible payload, but that's plain madness, I have over 70 different payload-objects