# How to handle payload names with blank space

**URL:** <https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056>\
**Category:** General\
**Created:** [12 December 2022 09:00 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056 "2022-12-12T09:00:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![schmarra](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@schmarra](https://discourse.nodered.org/u/schmarra)\
**Post date:** [12 December 2022 09:00 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056/1 "2022-12-12T09:00:15Z")

</div>

Hi,  
I´m using a module (node-red-contrib-luxtronik2-ws) to read data from my heat pump controller.  
Target is to share the info on the dashboard.

Related to that there are a few questions:

1. Some of the output payload contains blanks, like "STB E-Stab" with it´s values.

I guess that payload have to be without any blank. Anyway, the text-node is not shown in the dashboard

1. Some of the payload contain german Umlauts, how to handle them?  
Example: "Außentemperatur"  
I´ve already tried several methods, like copying the original one (from debug) or translating via unicode-esacpe, but no success so far

2. Some of the values return "" if there is no action ongoing. If already tried to handle it with the change node as well as the function node - see example:

```auto
if (msg.payload.Informationen.Anlagenstatus.Betriebszustand === "")
    msg.payload.Informationen.Anlagenstatus.Betriebszustand = "Keine Anforderung"
if (msg.payload.Informationen.Anlagenstatus.Betriebszustand === "WW")
    msg.payload.Informationen.Anlagenstatus.Betriebszustand = "Warmwasser"
if (msg.payload.Informationen.Anlagenstatus.Betriebszustand === "ww")
    msg.payload.Informationen.Anlagenstatus.Betriebszustand = "Warmwasser"
else msg.payload.Informationen.Anlagenstatus.Betriebszustand = "Nicht erfasst"

```

In this case the condition is not working, even I copied the value directly from the debug message. Even the condition with "WW" does not work.

Here some impression how it looks:

 ![Screenshot luxtronik2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/2/6251e313a08d18698a42e8d71ee860a1d41d2a1d.png)

Thanks in advance - and let me know if there is something missing

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 December 2022 09:28 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056/2 "2022-12-12T09:28:17Z")

</div>

Although I am not entirely sure what you are trying to accomplish, assuming you want to "translate" the "Betriebzustand" to something else, you could use a lookup object, which should work with German characters too, something like:

```auto
const input = msg.payload.Informationen.Anlagenstatus?.Betriebszustand
const convert = { 'Außentemperatur': 'temperature', 'WW': 'Warmwasser', 'ww':"Warmwasser" }
const payload = (convert[input] == undefined) ? 'Keine Anforderung' : convert[input] 

msg.payload.Informationen.Anlagenstatus.Betriebszustand = payload

return msg;

```

---

<div class="post-metadata">

**Author:** ![schmarra](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@schmarra](https://discourse.nodered.org/u/schmarra)\
**Post date:** [12 December 2022 09:57 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056/3 "2022-12-12T09:57:55Z")

</div>

Thank you for the support.

As mentioned, in general my idea is to provide the values in the dashboard.

Regarding the "Anlagenstatus": The output contains not human readable information, such as "WW" for warm water heating or even worse the "" for no action.

Not sure if your solution respects that "Außentemperatur" is a variable/payload name, not a value

---

<div class="post-metadata">

**Author:** ![m-schaeffler](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/m-schaeffler/32/55123_2.png) [@m-schaeffler](https://discourse.nodered.org/u/m-schaeffler)\
**Post date:** [12 December 2022 10:01 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056/4 "2022-12-12T10:01:20Z")

</div>

for the value conversion, you should use a `switch/case` statement.  
For ther Umlaut: `payload["Außentemperatur"]` could be working.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 December 2022 10:10 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056/5 "2022-12-12T10:10:07Z")

</div>

> Not sure if your solution respects that "Außentemperatur" is a variable/payload name, not a value

I am not sure what you mean, your function+example does not reflect a realworld object, so it is a bit hard to reverse engineer.

If i input this:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/e/9eb4845c6ac6fac881b81b42316f844c805ad279.png)  
this will be the result:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/405908dd3bfb545601e6d999be448841a085f5f8.png)

---

<div class="post-metadata">

**Author:** ![schmarra](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@schmarra](https://discourse.nodered.org/u/schmarra)\
**Post date:** [12 December 2022 13:22 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056/6 "2022-12-12T13:22:19Z")

</div>

Of course you´re right, its not shown. Thats why I did a separate point and didn´t mention that its about a value. As I´m quite new please let me know how to be more precise in the naming, also what you mean with "realworld object".

Nevertheless, here is what I mentioned:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/1065c1c3d4e5692dfa710e301b7452408ccf6f96.png)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 December 2022 15:27 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056/7 "2022-12-12T15:27:57Z")

</div>

Ok could you explain the question ?

keys with spaces and/or other characters can be read like:

`msg.payload.Informationen.Anlagenstatus["Außentemperatur"]`

---

<div class="post-metadata">

**Author:** ![schmarra](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@schmarra](https://discourse.nodered.org/u/schmarra)\
**Post date:** [13 December 2022 07:18 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056/8 "2022-12-13T07:18:32Z")

</div>

This is really strange, I thought I already tested this spelling - but obviously I did not. It works, thank you for your support!

Also the lookup object solved the issue

---

<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:** [27 December 2022 07:19 UTC](https://discourse.nodered.org/t/how-to-handle-payload-names-with-blank-space/72056/9 "2022-12-27T07:19:09Z")

</div>

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