# Set Switch: Easy Question

**URL:** <https://discourse.nodered.org/t/set-switch-easy-question/29393>\
**Category:** General\
**Created:** [2 July 2020 16:52 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393 "2020-07-02T16:52:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [2 July 2020 16:52 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/1 "2020-07-02T16:52:48Z")

</div>

but not for me 🙂

Hi there,

i would like a build a Switch Node with the Payload Data from mqtt input.

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/078236727db6b0adda7305704d05323ee78365d4.png)

If payload Data AAA4178400C8XXXXXX then Switch output 1.

Thanks for help!

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [2 July 2020 16:55 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/2 "2020-07-02T16:55:26Z")

</div>

Your payload is still a JSON string, make sure you convert it to an object using either the JSON node or by setting the MQTT input node to parse JSON.

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [2 July 2020 17:01 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/3 "2020-07-02T17:01:25Z")

</div>

Hi,  
thanks for reply..

something like that?

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/6/76a388303cca9dd04722b626046878834061c8df.png)

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/5/e5e2ed7ce4884e02e84848729dafb9489f6d4690.png)

But this node is not function:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7feea581d0f73b1bbe29eb10e3ea8f63a41aad93.png)

what did i do wrong?

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [2 July 2020 17:02 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/4 "2020-07-02T17:02:30Z")

</div>

Yes although in your switch you will need `msg.payload.RfRaw.Data`

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [2 July 2020 17:06 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/5 "2020-07-02T17:06:54Z")

</div>

> [@nlecaude](#):
>
> payload.Data.RfRaw

this not function ☹

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/424f70ca3c466ffa02ea90e857877ec4497f44c8.png)

The debug node (msg) is empty...

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [2 July 2020 17:12 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/6 "2020-07-02T17:12:47Z")

</div>

Try `payload.RfRaw.Data`

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [2 July 2020 17:13 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/7 "2020-07-02T17:13:09Z")

</div>

Yup typo on my end.

---

<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:** [2 July 2020 17:14 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/8 "2020-07-02T17:14:53Z")

</div>

You should use the copy button in the debug window - no more typos.

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [2 July 2020 17:15 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/9 "2020-07-02T17:15:23Z")

</div>

Typo was on my side not his (in my reply)

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [2 July 2020 17:19 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/10 "2020-07-02T17:19:00Z")

</div>

> [@E1cid](#):
>
> payload.RfRaw.Data

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/4/540aef1fe7315294a3a5e4fa0025b7ff1a65802a.png)

I had already tried. does not work either ☹

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [2 July 2020 17:20 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/11 "2020-07-02T17:20:11Z")

</div>

is this right???

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/9/f973054e2a06d1bd86504cb3d64273486d5f5e2a.png)

---

<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:** [2 July 2020 17:20 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/12 "2020-07-02T17:20:44Z")

</div>

Sorry. My mistake. Still true for the OP though 🙂

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [2 July 2020 17:21 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/13 "2020-07-02T17:21:20Z")

</div>

That does look ok

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [2 July 2020 17:25 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/14 "2020-07-02T17:25:51Z")

</div>

Is it possible there's a newline at the end of your incoming string ? Can you try to replace `==` by `contains` ?

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [2 July 2020 17:33 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/15 "2020-07-02T17:33:36Z")

</div>

no ☹

I do not understand that...

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [2 July 2020 17:48 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/16 "2020-07-02T17:48:28Z")

</div>

I thought I understood that 🙂

---

<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:** [2 July 2020 17:59 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/17 "2020-07-02T17:59:07Z")

</div>

Lol - I'll summarise...

Just hover the debug item and use the copy path button - helps you get the path to the item of interest without any mistakes. Then you just paste it into the change or switch node. No fuss no muss.

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [2 July 2020 18:02 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/18 "2020-07-02T18:02:24Z")

</div>

Alternatively to the approach of adding a JSON node behind an MQTT-in, you could also edit in the MQTT node that it should give output as parsed JSON, if you do that you can skip the json node.

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [2 July 2020 18:08 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/19 "2020-07-02T18:08:52Z")

</div>

Do I have. the path is correct ☹

---

<div class="post-metadata">

**Author:** ![get-command](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/get-command/32/25038_2.png) [@get-command](https://discourse.nodered.org/u/get-command)\
**Post date:** [2 July 2020 18:32 UTC](https://discourse.nodered.org/t/set-switch-easy-question/29393/20 "2020-07-02T18:32:55Z")

</div>

there is a good tip, thanks. you don't need an additional JSON node. But unfortunately the result is the same ☹

[Next page](https://discourse.nodered.org/t/set-switch-easy-question/29393.md?page=2)
