Can’t get OkHttp’s response.body.toString() to return a string

You have use .string() function to print the response in System.out.println(). But at last in Log.i() you are using .toString().

So please use .string() on response body to print and get your request’s response, like:

response.body().string();

NOTE:

  1. .toString(): This returns your object in string format.

  2. .string(): This returns your response.

I think this solve your problem… Right.

Leave a Comment