当我向 api 发出 API 请求时,我收到 JSON 格式的响应。
当我做System.Out.Println
响应时,我得到了这个。
HTTP/1.1 200 OK [Date: Thu, 04 Oct 2012 20:33:18 GMT, Server: Apache/1.3.33 (Unix) PHP/4.4.0, Cache-control: no-cache, must-revalidate, no-cache="Set-Cookie", private, Expires: Fri, 01 Jan 1990 00:00:00 GMT, Pragma: no-cache, X-CreationTime: 0.051, Set-Cookie: DT=1349382798:29998:365-l4; path=/; expires=Fri, 01-Jan-2020 00:00:00 GMT; domain=.wunderground.com, Connection: close, Transfer-Encoding: chunked, Content-Type: application/json; charset=UTF-8]
但这不是预期的反应,反应应该是这样的,
response: {
name:
class:
}
我正在使用 Apache HTTP 客户端。
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url);
HttpResponse response = httpclient.execute(httpget);
System.out.println(response);
为了获得预期的结果,我接下来应该做什么?我只需要一个正确的方向。