JSONとは
JSONはRubyでいうところのハッシュのようなデータ形式で、ひとつのキーに対してひとつのバリューを持つキーバリューストアという形で値を保持します。キーバリューストアの性質を持ったデータ型は各言語に存在します。JSONから各言語のキーバリューストアなデータ型に変換することができるので、多くのWeb APIはJSON形式でリクエストに対する値を返します。
ex)ロンドンの天気を調べた際のJSON
"coord": { "lon": -0.13, "lat": 51.51 }, "weather": [ { "id": 801, "main": "Clouds", "description": "few clouds", "icon": "02n" } ], "base": "stations", "main": { "temp": 286.412, "pressure": 1024.18, "humidity": 89, "temp_min": 286.412, "temp_max": 286.412, "sea_level": 1031.79, "grnd_level": 1024.18 }, "wind": { "speed": 2.41, "deg": 170 }, "clouds": { "all": 24 }, "dt": 1474487701, "sys": { "message": 0.191, "country": "GB", "sunrise": 1474436813, "sunset": 1474480706 }, "id": 2643743, "name": "London", "cod": 200