# How to detect empty string in a structure

**URL:** <https://discourse.nodered.org/t/how-to-detect-empty-string-in-a-structure/24826>\
**Category:** General\
**Created:** [14 April 2020 17:34 UTC](https://discourse.nodered.org/t/how-to-detect-empty-string-in-a-structure/24826 "2020-04-14T17:34:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![monkeyjacob17](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/monkeyjacob17/32/19971_2.png) [@monkeyjacob17](https://discourse.nodered.org/u/monkeyjacob17)\
**Post date:** [14 April 2020 17:34 UTC](https://discourse.nodered.org/t/how-to-detect-empty-string-in-a-structure/24826/1 "2020-04-14T17:34:32Z")

</div>

Hello,

I'm getting data from a PLC and I get a strucutre like below :

{"signal":"MsgAppro\_UK28","path":"DB58,STRING134..63","error":0,"value":[""]}

With the function "Switch", I test with the "Empty" or "Not Empty" comparison and I got always a value (with debug function) with the "Not empty" output. But the string is really empty but I think, the function detect the "".  
In the switch function, the payload is msg.payload.value  
Have you got a solution for that?

Thanks a lot,

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 April 2020 17:41 UTC](https://discourse.nodered.org/t/how-to-detect-empty-string-in-a-structure/24826/2 "2020-04-14T17:41:44Z")

</div>

> [@monkeyjacob17](#):
>
> "value":[""]

`value` is an array with 1 element that happens to be empty string (so value is not an empty string)

You should read the "[working with messages](https://nodered.org/docs/user-guide/messages)" documentation. It shows you how to copy the correct path from a debug message.

Well worth spending 10mins to absorb it (will save you having to ask here)
