Remove white spaces

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

{"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}

try using the actual whitespace in the regex:

msg.payload = msg.payload.replace(/ /g,““);
1 Like

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

msg.payload["AP name"]
1 Like

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