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.
I don't know about JSONObject
but you can try Observable<Response<JsonElement>>
which has a similar API.
I believe that should deserialize your Json into a JsonElement
object
You can also call Response.body()
or Response.errorBody()
if you just need the json String.