# Remove white spaces

**URL:** <https://discourse.nodered.org/t/remove-white-spaces/24541>\
**Category:** General\
**Created:** [9 April 2020 18:06 UTC](https://discourse.nodered.org/t/remove-white-spaces/24541 "2020-04-09T18:06:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![srynearson](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/srynearson/32/19230_2.png) [@srynearson](https://discourse.nodered.org/u/srynearson)\
**Post date:** [9 April 2020 18:06 UTC](https://discourse.nodered.org/t/remove-white-spaces/24541/1 "2020-04-09T18:06:08Z")

</div>

This might be an easy question to answer but I have not been able to figure it out. I have an incoming flow that has white spaces in some of the ordered pairs. What nodes can I use to remove the white spaces? I tried replace /s with "" and several other ways but couldnt get it to work.

example below "AP name" can be apname or ap\_name or whatever without spaces. I cant seem to call up the data when it has a space in it. msg.payload.AP\_name

```auto
{"AP name":"LR-AP-325-Point","Age(d:h:m)":"09:02:30","Auth":"MAC","Essid/Bssid/Phy":"PunkinAters/a8:bd:27:cb:ab:12/a-VHT","Forward mode":"tunnel","Host Name":null,"IP":"10.1.2.113","MAC":"f4f5d8ab8ca0","Name":"iot-lr-tv","Profile":"RYNO-MPSK_aaa_prof","Roaming":"Wireless","Role":"media-player","Type":"Linux","User Type":"WIRELESS","VPN link":null}

```

---

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [9 April 2020 18:09 UTC](https://discourse.nodered.org/t/remove-white-spaces/24541/2 "2020-04-09T18:09:30Z")

</div>

try using the actual whitespace in the regex:

```auto
msg.payload = msg.payload.replace(/ /g,““);

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [9 April 2020 18:10 UTC](https://discourse.nodered.org/t/remove-white-spaces/24541/3 "2020-04-09T18:10:39Z")

</div>

To access an object property that contains a space in its name, you use this syntax:

```auto
msg.payload["AP name"]

```

---

<div class="post-metadata">

**Author:** ![srynearson](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/srynearson/32/19230_2.png) [@srynearson](https://discourse.nodered.org/u/srynearson)\
**Post date:** [9 April 2020 18:16 UTC](https://discourse.nodered.org/t/remove-white-spaces/24541/4 "2020-04-09T18:16:14Z")

</div>

Sweet! I will add both tools to my tool kit! Thank you guys!

---

<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:** [9 April 2020 19:19 UTC](https://discourse.nodered.org/t/remove-white-spaces/24541/8 "2020-04-09T19:19:26Z")

</div>


