【发布时间】:2015-02-02 23:10:26
【问题描述】:
当我运行这个使用 json 查询到 Weather Underground 的草图时,我不确定为什么会收到错误消息 'The function getJSONArray(JSONArray) doesn't exist'。该评论似乎不合逻辑,因为 Processing 正在识别 JSONArray 的 id ref。
.json 可以在这里阅读:http://api.wunderground.com/api/97a2805510de59e9/hourly/q/pws:IENGLAND274.json
有什么想法吗?谢谢。
import com.francisli.processing.http.*;
HttpClient client;
String data;
com.francisli.processing.http.JSONObject weatherInfo;
JSONArray hourly_forecast;
int last = 0;
PImage img;
Float humidity = 50.2;
void setup() {
size(700, 700);
client = new HttpClient(this, "api.wunderground.com");
client.GET("/api/97a2805510de59e9/hourly/q/pws:IENGLAND274.json");
background(255);
}
void responseReceived(HttpRequest request, HttpResponse response) {
println(response.getContentAsString());
weatherInfo = response.getContentAsJSONObject();
JSONArray hourly_forecast = weatherInfo.getJSONArray(hourly_forecast);
}
【问题讨论】:
标签: arrays json httpclient processing