How can I get String Json by Response from API in Java? I am trying to get And Parse them to Object but I not work
public class tedst {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
Gson gson = new Gson();
Request res = new Request.Builder().url("http://api.openweathermap.org/data/2.5/weather?q=Hanoi&APPID=bffca17bcb552b8c8e4f3b82f64cccd2&units=metric").build();
try {
Response response = client.newCall(res).execute();
Data data = gson.fromJson(response.toString(), Data.class);
} catch (IOException e) {
e.printStackTrace();
}
}