We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Any idea why this returns "JSON object ["temp_max"]is not a number"?
JSONObject losAngelesWeather;
void setup() { size(480, 320);
} void draw() {
String weatherLA_URL = "http://api.openweathermap.org/data/2.5/forecast?id=5368361&&cnt=1&APPID= 9972f563fbd40a4148b0b962bc535833"; losAngelesWeather = loadJSONObject(weatherLA_URL);
float temp = losAngelesWeather.getJSONArray("list").getJSONObject(0).getFloat("temp_max");
println(temp); }
Answers
https://Forum.Processing.org/two/discussion/15473/how-to-format-code-and-text
http://API.OpenWeatherMap.org/data/2.5/forecast?id=5368361&&cnt=1&APPID=9972f563fbd40a4148b0b962bc535833
{ "cod": "200", "message": 0.0037, "cnt": 1, "list": [ { "dt": 1521828000, "main": { "temp": 292.19, "temp_min": 287.526, "temp_max": 292.19, "pressure": 966.02, "sea_level": 1033.6, "grnd_level": 966.02, "humidity": 86, "temp_kf": 4.66 }, "weather": [ { "id": 500, "main": "Rain", "description": "light rain", "icon": "10d" } ], "clouds": { "all": 0 }, "wind": { "speed": 0.96, "deg": 158.502 }, "rain": { "3h": 0.0049999999999999 }, "sys": { "pod": "d" }, "dt_txt": "2018-03-23 18:00:00" } ], "city": { "id": 5368361, "name": "Los Angeles", "coord": { "lat": 34.0522, "lon": -118.2437 }, "country": "US" } }Thank you!