I am trying to assign the topic name using a string with the function node, however it does not work as expected.
var n1 = "var1"; // string will actually come from an incoming msg
dataset = {payload : {n1 : 12 , "var2" : 34}};
msg_o = dataset;
return msg_o;
This results in a payload of
{
n1 : 12,
var2 : 34
}
Instead of:
{
var1 : 12,
var2 : 34
}
Is this possible?