How to get in retrofit2 unknown JSON object from response object like this request (with OkHttp3):
Observable<Response<MyResponseObject>> apiCall(@Body body);
MyResponseObject look like this:
public class MyResponseObject {
@SerializedName("title")
public String title;
@SerializedName("info")
public JSONObject info;
@SerializedName("question_id")
public String questionId;
}
I want to get
JSONObject info
like a regular object.
You need to create another class (Info):
public static class Info {
@SerializedName("description")
public String mDescription;
@SerializedName("preview_image")
public String mPreviewImage;
}
and in MyResponseObject:
@SerializedName("info")
public Info info;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With