【发布时间】:2016-05-10 10:08:08
【问题描述】:
我正在尝试使用 node-red...
我做这个网络查询https://api.forecast.io/forecast/
这是给定的输出:
{"latitude":-25.74486,"longitude":28.18783,"timezone":"Africa/Johannesburg","offset":2,"currently":
{"time":1462871342,"summary":"Foggy","icon":"fog","precipIntensity":0,"precipProbability":0,
"temperature":18.08,"apparentTemperature":18.08,
"dewPoint":9.3,"humidity":0.57,"windSpeed":3.75,"windBearing":351,"visibility":2.78,
"cloudCover":0.23,"pressure":1024.87,"ozone":252.43}}
这似乎是正确的。
Parse Weather 中的代码是
//parse forecast.io message
var weather = JSON.parse(msg.payload);
return weather.currently.temperature;
我得到的错误是:
TypeError:无法分配给 19.49 的只读属性“_msgid”
这个值似乎还可以。
我做错了什么?
提前致谢。
【问题讨论】:
-
我在您的 JSON 中没有看到任何名为“_msgid”的属性。有的话能不能也给个JS代码?
标签: node-red