Hey guys!
I need some help. In the first payload there is an array of data and I want to write a function that puts that array one step further.
Now it is msg.payload[ ] ==> I want it to be msg.payload.metadata[ ]
Can you help me?
Thanks!
Hey guys!
I need some help. In the first payload there is an array of data and I want to write a function that puts that array one step further.
Now it is msg.payload[ ] ==> I want it to be msg.payload.metadata[ ]
Can you help me?
Thanks!
use a function node...
var arr = msg.payload; //store a ref to the array in "arr" temporarily
msg.payload = {}; //make msg.payload an (empty) object
msg.payload.metadata = arr; //store "arr" in msg.payload.metadata
return msg; //return the msg to next node
↑ deliberately verbose for readability ↑
You can also do this with a change node & probably other ways too.
Thank you, it worked!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.