将对象数组分为单独的对象
我在节点红色中有这个对象:
{
"topic":
[
{
"nodeid": "ns=1;s=sensor1"
},
{
"nodeid": "ns=1;s=sensor2"
},
],
"payload": [
{
"value": 1234
},
{
"value": 6789
},
.....
.....
],
"datatype": [
{
"datatype": "Int16"
},
{
"datatype": "Int16"
},
]
}
我想要单独的消息序列:
{
"_msgid": "xxxxx1",
"payload": 1234,
"topic": "ns=1;s=sensor1",
"datatype": "Int16"
}
{
"_msgid": "xxxxx2",
"payload": 6789,
"topic": "ns=1;s=sensor2",
"datatype": "Int16"
}
我尝试了“ for” for“ for”循环,但没有找到解决方案。
I have this object in Node-Red:
{
"topic":
[
{
"nodeid": "ns=1;s=sensor1"
},
{
"nodeid": "ns=1;s=sensor2"
},
],
"payload": [
{
"value": 1234
},
{
"value": 6789
},
.....
.....
],
"datatype": [
{
"datatype": "Int16"
},
{
"datatype": "Int16"
},
]
}
I want separate sequences of messages:
{
"_msgid": "xxxxx1",
"payload": 1234,
"topic": "ns=1;s=sensor1",
"datatype": "Int16"
}
{
"_msgid": "xxxxx2",
"payload": 6789,
"topic": "ns=1;s=sensor2",
"datatype": "Int16"
}
I tried with "for" loop but don't have find a solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我尝试关注有效解决方案:
返回;
I have tried follow valid solution:
return;