MSW APIには次のように記載されています。
私たちの API は RESTful 規約に従います。場所の情報のクエリは、http: //magicseaweed.com/api/YOURAPIKEY/forecast/?spot_id =10 を呼び出すのと同じくらい簡単です。
次のように、特定の時間枠の予測を表す一連のデータで構成される JSON 配列を受け取ります。
[
{
"timestamp": 1367366400,
"localTimestamp": 1367366400,
"issueTimestamp": 1367366400,
"fadedRating": 0,
"solidRating": 0,
"swell": {
"minBreakingHeight": 1,
"absMinBreakingHeight": 0.504,
"maxBreakingHeight": 1,
"absMaxBreakingHeight": 0.784,
"unit": "ft",
"components": {
"combined": {
"height": 1.6,
"period": 5,
"direction": 252.47,
"compassDirection": "ENE"
},
"primary": {
"height": 0.5,
"period": 7,
"direction": 92.49,
"compassDirection": "W"
},
"secondary": {
"height": 0.2,
"period": 9,
"direction": 52.9,
"compassDirection": "SW"
},
"tertiary": {
"height": 1.5,
"period": 5,
"direction": 248.62,
"compassDirection": "ENE"
}
}
},
"wind": {
"speed": 6,
"direction": 221,
"compassDirection": "NE",
"chill": 32,
"gusts": 9,
"unit": "mph"
},
"condition": {
"pressure": 1026,
"temperature": 39,
"weather": "10",
"unitPressure": "mb",
"unit": "f"
},
"charts": {
"swell": "htt://chart-1-us.msw.ms/wave/750/1-1367366400-1.gif",
"period": "htt://chart-1-us.msw.ms/wave/750/1-1367366400-2.gif",
"wind": "htt://chart-1-us.msw.ms/gfs/750/1-1367366400-4.gif",
"pressure": "htt://chart-1-us.msw.ms/gfs/750/1-1367366400-3.gif",
"sst": "htt://chart-1-us.msw.ms/sst/750/1-1367366400-10.gif"
}
},
{
"timestamp": 1367377200,
"localTimestamp": 1367377200,
"issueTimestamp": 1367366400,
"fadedRating": 0,
"solidRating": 0,
"swell": {
"minBreakingHeight": 0,
"absMinBreakingHeight": 0.384,
"maxBreakingHeight": 1,
"absMaxBreakingHeight": 0.6,
"unit": "ft",
"components": {
"combined": {
"height": 1.8,
"period": 4,
"direction": 266.06,
"compassDirection": "E"
},
"primary": {
"height": 0.4,
"period": 6,
"direction": 92.53,
"compassDirection": "W"
},
"secondary": {
"height": 0.2,
"period": 9,
"direction": 52.72,
"compassDirection": "SW"
},
"tertiary": {
"height": 1.8,
"period": 4,
"direction": 258.73,
"compassDirection": "ENE"
}
}
},
"wind": {
"speed": 5,
"direction": 255,
"compassDirection": "ENE",
"chill": 34,
"gusts": 7,
"unit": "mph"
},
"condition": {
"pressure": 1025,
"temperature": 41,
"weather": "10",
"unitPressure": "mb",
"unit": "f"
},
"charts": {
"swell": "htt://chart-1-us.msw.ms/wave/750/1-1367377200-1.gif",
"period": "htt://chart-1-us.msw.ms/wave/750/1-1367377200-2.gif",
"wind": "htt://chart-1-us.msw.ms/gfs/750/1-1367377200-4.gif",
"pressure": "htt://chart-1-us.msw.ms/gfs/750/1-1367377200-3.gif",
"sst": "htt://chart-1-us.msw.ms/sst/750/1-1367377200-10.gif"
}
}, THIS CONTINUES ON UNTIL THE END OF THE ARRAY
JSON Array を呼び出す方法と、各項目に変数を割り当てる方法 (または後で HTML などで使用するために各項目にアクセスする方法) を教えてください。
ありがとう。