I am doing android, looking for a way to do a super basic http GET/POST request. I keep getting an error:
java.lang.IllegalArgumentException: Unable to creat
make sure its JsonObject
not a JSONObject
Call call = api.getJsonData(url);
call.enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) {
String str = response.body().toString();
Log.e(TAG, "onResponse: " + str);
}
@Override
public void onFailure(Call call, Throwable t) {
Log.e(TAG, "onFailure: " + t.getMessage());
}
});
By using JsonObject
you can get any type of response in string format.