My array payload is like: msg.payload[index].temp. I cut the array in single parts to publish the single parts of the array via MQTT.
So I got msg.payload.temp and msg.parts.index.
msg:{
payload:{
address: "e4:32:a3:3a:99:97";
temp: "32"
}
parts: {
type: "array";
index: "16";
count: "17";
}
}
Is it possible to put the number of the index into the name msg.payload.temp? So I got something like msg.payload.temp_6. I tried to combine strings together like:
var temp = "msg.payload.temp_" + msg.parts.index.toString();
temp = payload.temp;
return msg;
Do I need a conversation from string to json so Node-Red detect the property?