Super Noob Question Concerning Referencing msg.payload in the next node

Its a simple question, I'm sure. I have a text input box that is connected to a change node to add more text to the already existing text in msg.payload. For instance the text box passes "This is a test" I want to then add prepend "msg" to that. So I end up with "msg This is a test", without the quotes. I tried "msg {{message}} and that didn't work. Also msg ${message} and a host of other things. This is the pertinent part of the flow i'm having trouble with. Thanks for any guidance.

[{"id":"ba890110.5f479","type":"change","z":"831bf7fc.204748","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg {{message}}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":300,"wires":[["1f083f69.891931"]]}]

Maybe i'm going at this wrong? A different node?
Thanks again for any insight.

Try in a change node;


or use a Template node;


1 Like

Ok, yes, I removed the first chage node from my flow and just the single change node with that magic kung foo you gave me, "msg "&payload. lol. I get the "msg " part. But what does the & do? Also I assumed i would use the "string" mode. Obviously not. What is the funny 'J' mean?


Jsonata - JSONata Documentation · JSONata

Its a jsonata string concatenation operator. See Other Operators · JSONata

1 Like

Thank You, I appreciate you taking time to point me to the appropriate documentation. Be Safe out there.


Whenever the JSONata feels too complicated, there is always regular expressions :slight_smile:

1 Like

Really? you can do regex? Reminds me of the early days when I was working with Perl. If remember correctly, thats the beginning of the line. And so that would prepend "msg " to msg.payload?

Yet another option, in a Function node

msg.payload = `msg ${msg.payload}`
// or this
// msg.payload = "msg " + msg.payload
return msg
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.