Hi I am trying to recreate the following format
object
topic: "owl"
payload: object
Name: "53"
IP: "27"
so I understand that to get the IP from this result I would access msg.payload.IP fine!
But how do I recreate the input to produce this result
I have a function node with msg.payload="27" then I have a change node with set msg.payload.IP to msg.payload but it doesn't create the payload:object or the IP what am I doing wrong.
You first used msg.payload to store a string, and that is fine. Then you want to use msg.payload to be an object with property IP. Indeed, that is not possible. You can not add properties to a string.
A simple solution is to delete msg.payload in the change node, as shown below: