# Single space getting passed to nodes

**URL:** <https://discourse.nodered.org/t/single-space-getting-passed-to-nodes/34247>\
**Category:** General\
**Created:** [14 October 2020 14:23 UTC](https://discourse.nodered.org/t/single-space-getting-passed-to-nodes/34247 "2020-10-14T14:23:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romprod](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@Romprod](https://discourse.nodered.org/u/Romprod)\
**Post date:** [14 October 2020 14:23 UTC](https://discourse.nodered.org/t/single-space-getting-passed-to-nodes/34247/1 "2020-10-14T14:23:38Z")

</div>

Hi,

I have a tasker receive node which spits text in to a flow but every so often it outputs the following which is causing issues.

I've tried filtering out with a switch node but I can't seem to get the correct settings to stop it passing to the next node. (Plus I'm a noob at this so not entirely sure how to do this in the first place, I've just been guessing)

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

Can anyone suggest how to stop this getting passed to the next node?

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [14 October 2020 14:45 UTC](https://discourse.nodered.org/t/single-space-getting-passed-to-nodes/34247/2 "2020-10-14T14:45:10Z")

</div>

This little JSONata trick may be good start.

```auto
[{"id":"1251277f.503ec9","type":"switch","z":"2cc2b60c.fb70ba","name":"","property":"payload.var","propertyType":"msg","rules":[{"t":"jsonata_exp","v":"$length($trim(payload.var)) != 0","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":1,"x":590,"y":220,"wires":[["8c3554d3.c67228"]]},{"id":"a133cd9d.678c1","type":"inject","z":"2cc2b60c.fb70ba","name":"space","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"command\":\"node\",\"var\":\" \"}","payloadType":"json","x":430,"y":200,"wires":[["1251277f.503ec9"]]},{"id":"8c3554d3.c67228","type":"debug","z":"2cc2b60c.fb70ba","name":"DEBUG","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":220,"wires":[]},{"id":"9265f70e.d42858","type":"inject","z":"2cc2b60c.fb70ba","name":"string with space","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"command\":\"node\",\"var\":\" m\"}","payloadType":"json","x":400,"y":240,"wires":[["1251277f.503ec9"]]}]

```

---

<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:** [13 December 2020 14:45 UTC](https://discourse.nodered.org/t/single-space-getting-passed-to-nodes/34247/3 "2020-12-13T14:45:22Z")

</div>

Closed on 13 December 2020 14:45 UTC

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