【发布时间】:2020-02-28 14:46:16
【问题描述】:
我最近开始使用 OKHttp 库向 API 发出请求,代码如下:
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api-football-v1.p.rapidapi.com/v2/players/player/874")
.get()
.addHeader("x-rapidapi-host", "api-football-v1.p.rapidapi.com")
.addHeader("x-rapidapi-key", "6147bd5da4mshfacf56a7067aa5ep1ff9e6jsn60984dedb281")
.build();
okhttp3.Response response = client.newCall(request).execute();
}
现在,我想知道如何打印以字符串“firstname”为“key”的值。
【问题讨论】: