Change node not working as I expected

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:

r-01

or alternatively:

r-02

I thought that Move msg.payload to msg.payload.ip would work but not at my pc so can't check.

1 Like

Hi Colin,

Indeed, and this would be the best choice, in my opinion :slight_smile:

r-03

Yep that's sorted it thanks

1 Like