1
我試圖用這個來從天氣地下API 3天的天氣預報:天氣地下API - 幫助推算未來 - 的Javascript
var Forcast = parsed_json['forecast']['txt_forecast']['period'][0]['fcttext_metric'];
它不工作,我有沒有JSON經驗,所以我不有一個線索,我需要做的是爲了這個工作。貝婁是我想要的json文件的一部分:
"forecast": {
"txt_forecast": {
"date": "2:00 PM PDT",
"forecastday": [{
"period": 0,
"icon": "partlycloudy",
"icon_url": "http://icons-ak.wxug.com/i/c/k/partlycloudy.gif",
"title": "Tuesday",
"fcttext": "Partly cloudy in the morning, then clear. High of 68F. Breezy. Winds from the West at 10 to 25 mph.",
"fcttext_metric": "Partly cloudy in the morning, then clear. High of 20C. Windy. Winds from the West at 20 to 35 km/h.",
"pop": "0"
}, {
有人請告訴我如何獲得我需要的信息。
你看到什麼問題? – ThinkingStiff
如果我使用我說我試過的代碼..我什麼也沒得到:如果我只是使用這個 'var Forcast = parsed_json ['forecast'] ['fcttext_metric'];' 然後其他命令工作,但我沒有得到任何預測的信息 – ChristopherStrydom