Msg.payload in json

easy question for you all. I am trying to set a variable: msg.payload: 10, in a json format. The msg.payload : 10 must replace the "timeout" : 20
{
"payload": "on",
"timeout": 20,
"warning": 5
}
thanks.

Hi @Duncan

Just to clarify, you want to set msg.payload to the object:

{
   "payload": "on",
   "timeout": 20,
   "warning": 5
}

but you want to replace the timeout value (20 in the example) with the existing value of msg.payload?

If that is the case, then a Function node with the follow would do it:

msg.payload = {
   "payload": "on",
   "timeout": msg.payload,
   "warning": 5
}
return msg;

If that isn't what you meant, then maybe you could clarify.

exactly what I meant, thanks it works. I might just get the hang of this eventually.