Skip to content

Instantly share code, notes, and snippets.

@yoggy
Created August 15, 2014 08:16
Show Gist options
  • Save yoggy/3250840920de9b6a032c to your computer and use it in GitHub Desktop.
Save yoggy/3250840920de9b6a032c to your computer and use it in GitHub Desktop.
天気予報を表示するスケッチ例
//
// weather_json_sample.pde - 天気予報を表示するスケッチ例
//
// 天気予報JSONデータについては下記参照
// http://weather.livedoor.com/weather_hacks/webservice
//
String url = "http://weather.livedoor.com/forecast/webservice/json/v1?city=130010";
JSONObject json;
String publicTime;
String title;
String telop;
void setup() {
size(200, 160);
json = loadJSONObject(url);
println(json);
publicTime = json.getString("publicTime");
title = json.getString("title");
JSONArray forecasts = json.getJSONArray("forecasts");
telop = forecasts.getJSONObject(0).getString("telop");
}
void draw() {
background(#ffffff);
fill(#000000);
text(publicTime, 10, 20);
text(title, 10, 40);
text(telop, 10, 60);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment