Adding a dynamic amount of values to a JavaScript Object Property

bakman2 I cannot thank you enough! Your solution works like a charm! To generate an unknown amount of property keys I just had to adjust a little bit of your code to let it act like the push method

msg.object = [{ property: { }}];

for (let i = 0 ; i<5; i++){
msg.object[0].property["key_" +i] = "value_"+i;
}

return msg;

66351358f3618512

I am so glad the node-red community is that awesome :raised_hands:

2 Likes