# Remove " " in payload

**URL:** <https://discourse.nodered.org/t/remove-in-payload/53522>\
**Category:** General\
**Created:** [10 November 2021 17:13 UTC](https://discourse.nodered.org/t/remove-in-payload/53522 "2021-11-10T17:13:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Schmtterfliege](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@Schmtterfliege](https://discourse.nodered.org/u/Schmtterfliege)\
**Post date:** [10 November 2021 17:13 UTC](https://discourse.nodered.org/t/remove-in-payload/53522/1 "2021-11-10T17:13:47Z")

</div>

Hi all,

I searched google and this forum, but didn't find an answer my specific question.

I'm trying to create a table in the dashboard showing the room name, temperature and humidity of my 10 Aqara Multisensors.  
For this I am using the "table" node from node-red-node-ui-table.

This table uses the following format as payload:

var data = [  
{  
"Raum": "Küche",  
"Temperatur": temp,  
"Humidity": hum,  
}  
]

For single sensors I am able to create this table, but not for all 10 of them.  
What I'm doing is the following:  
Get the humidity and temperature of a sensor from iobroker and in a function node do the following:

```auto
temp = msg.payload[1] + "°C";
hum = msg.payload[0] + "%";

var data = '{ "Raum": "Küche", "Temperatur": temp, "Humidity": hum, }';

msg.payload = data;
return msg;

```

I do this for all 10 sensors and then join them via the join node.  
Then I use another function node to do the following:

```auto
var data = [
    msg.payload[0],
    msg.payload[1],
    msg.payload[2],
    msg.payload[3],
    msg.payload[4],
    msg.payload[5],
    msg.payload[6],
    msg.payload[7],
    msg.payload[8],
    msg.payload[9],
    ]

```

_msg.payload = data;_  
_return msg_;

What that gets me is this array:

```auto
0: "{ "Raum": "Flur 1", "Temperatur": temp, "Humidity": hum, }"
1: "{ "Raum": "Loggia", "Temperatur": temp, "Humidity": hum, }"
2: "{ "Raum": "Esszimmer", "Temperatur": temp, "Humidity": hum, }"
3: "{ "Raum": "Wohnzimmer", "Temperatur": temp, "Humidity": hum, }"
4: "{ "Raum": "Büro", "Temperatur": temp, "Humidity": hum, }"
5: "{ "Raum": "Schlafzimmer", "Temperatur": temp, "Humidity": hum, }"
6: "{ "Raum": "Kleines Bad", "Temperatur": temp, "Humidity": hum, }"
7: "{ "Raum": "Großes Bad", "Temperatur": temp, "Humidity": hum, }"
8: "{ "Raum": "Gästezimmer", "Temperatur": temp, "Humidity": hum, }"
9: "{ "Raum": "Küche", "Temperatur": temp, "Humidity": hum, }"

```

The array itself is fine, but the issue (I think) is that each value is a string enclosed in " ".  
The table node doesn't seem to know what to do with that.

Is there a way to create my data array without each entry being enclosed in " "?  
In the first functions that build each of those entries I have to assign a string to the payload, otherwhise it complains about the structur I try to put into the payload.  
The payload would be: { "Raum": "Büro", "Temperatur": temp, "Humidity": hum, }

I mitigated it by using join nodes only and then using payload[0][0], payload [0][1], payload[1][0] and so on, but that way the values are never in the correct order and my rooms, temperatures and humidity will be mixed around.

In short words: how can I remove the " " in my final function? 😃

I hope my request isn't too complicated :S

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [10 November 2021 17:40 UTC](https://discourse.nodered.org/t/remove-in-payload/53522/2 "2021-11-10T17:40:04Z")

</div>

> [@Schmtterfliege](#):
>
> ```auto
> temp = msg.payload[1] + "°C";
> hum = msg.payload[0] + "%";
> 
> ```

As you have concatenated the % and C to your payload you have made them strings if they where numbers already. best to not add the % and C. You can add them when you display the data in the table.

Then you can guarantee the payloads are numbers by doing

```auto
temp = Number(msg.payload[1]);
hum = Number(msg.payload[0]);

```

---

<div class="post-metadata">

**Author:** ![Schmtterfliege](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@Schmtterfliege](https://discourse.nodered.org/u/Schmtterfliege)\
**Post date:** [10 November 2021 18:32 UTC](https://discourse.nodered.org/t/remove-in-payload/53522/3 "2021-11-10T18:32:03Z")

</div>

You, sir, are amazing!  
That did the trick! 🙂

Thank you so very much!

---

<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:** [24 November 2021 18:32 UTC](https://discourse.nodered.org/t/remove-in-payload/53522/4 "2021-11-24T18:32:32Z")

</div>

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