# Multiple Payload in formated Output

**URL:** <https://discourse.nodered.org/t/multiple-payload-in-formated-output/12283>\
**Category:** General\
**Created:** [16 June 2019 11:36 UTC](https://discourse.nodered.org/t/multiple-payload-in-formated-output/12283 "2019-06-16T11:36:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![unixweb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/unixweb/32/9405_2.png) [@unixweb](https://discourse.nodered.org/u/unixweb)\
**Post date:** [16 June 2019 11:36 UTC](https://discourse.nodered.org/t/multiple-payload-in-formated-output/12283/1 "2019-06-16T11:36:47Z")

</div>

Hello NodeRed User

i am new here and i need some help.  
I am not an expert in coding (Not Programmer) but i understand how works Node-Red.

I have a JSON String like this

```auto
{"_timestamp": 1551212773, "Temp": 22.80, "Pressure": 1015, "Humidity": 80}

```

I made a function example with this code :

```auto
var temp = "30";
var hum = "80";
var press = "1050"

var msg1 = { payload: "user DG8RAD pass XXXX" };
var msg2 = { payload: "DG8RAD-1>APRS,TCPIP*:!4808.30N/01125.75E_000/000g003t030r000p000P000h80b09900wRSW" };                          
var msg3 = { payload: "DG8RAD-1>APRS,TCPIP*:>Maker Themen, LoraWAN, Arduino, Raspberry, SmartHome und AFU" };                          
var msg4 = { payload: "File delete" };                          
return [[ msg1, msg2, msg3], msg4 ]

```

I need exactly this syntax because is Part of APRS Protocol for Ham Radio.

How can add Temp / Pressure / Hum into this String of "var msg2"

I was thinking like in this form :

var msg2 = { payload: "DG8RAD-1\>APRS,TCPIP\*:!4808.30N/01125.75E\_000"+temp"/000g003t030r000p000P000h80b09900wRSW" };

But it doesn't work properly.  
Have anyone any idea how can implement this values ?

Best regards Joachim

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [16 June 2019 12:13 UTC](https://discourse.nodered.org/t/multiple-payload-in-formated-output/12283/2 "2019-06-16T12:13:48Z")

</div>

you are missing a plus after your variable name

---

<div class="post-metadata">

**Author:** ![unixweb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/unixweb/32/9405_2.png) [@unixweb](https://discourse.nodered.org/u/unixweb)\
**Post date:** [16 June 2019 12:48 UTC](https://discourse.nodered.org/t/multiple-payload-in-formated-output/12283/3 "2019-06-16T12:48:15Z")

</div>

Thanks a lot , problem solved  
My fault ☹

```auto
var msg2 = { payload: "DG8RAD-1>APRS,TCPIP*:!4808.30N/01125.75E_000/000g003t0"+temp+"r000p000P000h"+hum+"b"+press+"0wRSW" };

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [16 June 2019 14:04 UTC](https://discourse.nodered.org/t/multiple-payload-in-formated-output/12283/4 "2019-06-16T14:04:36Z")

</div>

Assuming you are using Node.js above v8.5 or so, you should also be able to use template strings which can be easier to read for things like this:

```auto
var msg2 = { payload: `DG8RAD-1>APRS,TCPIP*:!4808.30N/01125.75E_000${temp}/000g003t030r000p000P000h80b09900wRSW` };

```

Note the use of back-ticks as string delimiters and the variable wrapped in `${}` (which can be any JavaScript that returns something that can be interpreted as a string).
