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

**URL:** https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266
**Category:** General
**Created:** [2 February 2021 21:23 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266 "2021-02-02T21:23:14Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![westek](https://avatars.discourse-cdn.com/v4/letter/w/ee7513/32.png) [@westek](https://discourse.nodered.org/u/westek)
#### Post date: [2 February 2021 21:23 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266/1 "2021-02-02T21:23:14Z")

</div>

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.

```auto
[{"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.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [2 February 2021 21:31 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266/2 "2021-02-02T21:31:33Z")

</div>

Try in a change node;

![jsonata](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/4015ba608d6ef83fab3b0047e2d58b9a3a7aadd4.jpeg)

or use a Template node;

![temp](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cb55e03d693fcd73f0143012b9ed284becf52f9a.jpeg)

---

<div class="post-metadata">

### Author: ![westek](https://avatars.discourse-cdn.com/v4/letter/w/ee7513/32.png) [@westek](https://discourse.nodered.org/u/westek)
#### Post date: [2 February 2021 21:40 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266/3 "2021-02-02T21:40:23Z")

</div>

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?

THANKS!!!

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [2 February 2021 21:43 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266/4 "2021-02-02T21:43:44Z")

</div>

> [@westek](#):
>
> What is the funny 'J' mean?

Jsonata - [JSONata Documentation · JSONata](https://docs.jsonata.org/overview.html)

> [@westek](#):
>
> But what does the & do?

Its a jsonata string concatenation operator. See [Other Operators · JSONata](https://docs.jsonata.org/other-operators#-concatenation)

---

<div class="post-metadata">

### Author: ![westek](https://avatars.discourse-cdn.com/v4/letter/w/ee7513/32.png) [@westek](https://discourse.nodered.org/u/westek)
#### Post date: [2 February 2021 21:45 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266/5 "2021-02-02T21:45:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)
#### Post date: [2 February 2021 22:06 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266/6 "2021-02-02T22:06:30Z")

</div>

Whenever the JSONata feels too complicated, there is always regular expressions 🙂  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/a/4a15f14b77ba1d05218334111f4d5bba98d1dbd3.png)

---

<div class="post-metadata">

### Author: ![westek](https://avatars.discourse-cdn.com/v4/letter/w/ee7513/32.png) [@westek](https://discourse.nodered.org/u/westek)
#### Post date: [2 February 2021 22:42 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266/7 "2021-02-02T22:42:39Z")

</div>

🤩  
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?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [3 February 2021 09:52 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266/8 "2021-02-03T09:52:31Z")

</div>

Yet another option, in a Function node

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

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [17 February 2021 09:53 UTC](https://discourse.nodered.org/t/super-noob-question-concerning-referencing-msg-payload-in-the-next-node/40266/9 "2021-02-17T09:53:09Z")

</div>

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