I am trying to modifying a message payload in node-red by adding a new field coming from the global.context
. For example given the as input the following message.payload
{"field1" : 5}
and assuming the global context has a field {"lot" : {"f1" : 4, "f2" : 4}}
I want as output:
{
"field1" : 5,
"lot" : {"f1" : 4, "f2" : 4}
}
I would like to do it without using the function
palette.
As far as I understand this must be done with the change
setting move
global.context
to msg.payload
overwrites completely the message so that it results in final message payload being
{"lot" : {"f1" : 4, "f2" : 4}}
How is a new field-value pair added to the message payload?