I need help.
I have an endpoint that takes a parameter. Depending on this parameter, the JSON returned will be completely different.
Is it possi
Just to close this off.
You can get the raw JSON back from RetroFit and use GSON to manually serialise to the class type you want.
For example:
RestClient.get().getDataFromServer(params, new Callback() {
@Override
public void success(JSONObject json, Response response) {
if(isTypeA) {
//Use GSON to serialise to TypeA
} else {
//Use GSON to serialise to TypeB
}
}
});