how can I make the identifier variable
e.g.
how can I make the identifier variable
e.g.
var identifier = (msg.topic);
msg.payload = {
""+identifier+"" :msg.payload
}
return msg;
//Unfortunately, this method does not work
how can I make the identifier variable
e.g.
how can I make the identifier variable
e.g.
var identifier = (msg.topic);
msg.payload = {
""+identifier+"" :msg.payload
}
return msg;
//Unfortunately, this method does not work
With:
const identifier = msg.topic;
msg.payload = { [identifier]: msg.payload };
return msg;
that was quick, thank you very much