# Debug shows JSON but MQTT doesn't trigger

**URL:** <https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295>\
**Category:** General\
**Created:** [6 May 2022 13:02 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295 "2022-05-06T13:02:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![themed00](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@themed00](https://discourse.nodered.org/u/themed00)\
**Post date:** [6 May 2022 13:02 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295/1 "2022-05-06T13:02:40Z")

</div>

Hey,

I've had a few MQTTs IN and they work great.

But now, I'm sending via a online PHP Site a MQTT Message to one of my nodes.  
When I'm Sending an String for example "start" it works perfectly.

But when I'm sending a JSON to the MQTT IN it doesn't trigger but shows in the DEBUG? What I'm confusing here?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cb01a252c85ddad2a8e739bb1599db1e854677f4.png)

The JSON which I encoded with PHP is:

```auto
"{"subscription":{"id":"c1389533-d679-1334-9065-a4d78855abdb","status":"enabled","type":"channel.follow","version":"1","condition":{"broadcaster_user_id":"90205343"},"transport":{"method":"webhook","callback":"null"},"created_at":"2022-05-06T12:59:11.3793627Z","cost":0},"event":{"user_id":"44444","user_login":"testFromUser","user_name":"testFromUser","broadcaster_user_id":"44444","broadcaster_user_login":"90205343","broadcaster_user_name":"testBroadcaster","followed_at":"2022-05-06T12:59:11.3793627Z"}}"

```

Thanks for your help

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [6 May 2022 13:23 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295/2 "2022-05-06T13:23:22Z")

</div>

What do you mean by "It doesn't trigger"?

The snapshot of your flow only shows the mqtt in and debug nodes.  
What else are you expecting to happen?

---

<div class="post-metadata">

**Author:** ![themed00](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@themed00](https://discourse.nodered.org/u/themed00)\
**Post date:** [6 May 2022 13:40 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295/3 "2022-05-06T13:40:41Z")

</div>

I subscribed to this topic "datafromweb/light" with a microcontroller.

I got the message, when the webserver sends a string (over MQTT to this topic) but with the JSON, the MQTT is not recieved. So I meant "trigger" the MQTT message.

Greetings

---

<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:** [6 May 2022 13:58 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295/4 "2022-05-06T13:58:58Z")

</div>

The json you posted is not valid.  
the outer quotes are fine but the inner one's should be escaped with \ or replace outer with single quotes.

As it is not a valid json string the php script is probably not sending it.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [6 May 2022 14:05 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295/5 "2022-05-06T14:05:33Z")

</div>

Yes perhaps the quotes confuse whichever device sends the Mqtt message. You could try single quotes for the outermost " and ".  
(I can't test it, not at my computer).

---

<div class="post-metadata">

**Author:** ![themed00](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@themed00](https://discourse.nodered.org/u/themed00)\
**Post date:** [6 May 2022 14:08 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295/6 "2022-05-06T14:08:18Z")

</div>

Thanks for the replys.

Nodred Debug recievs the JSON. Then I'm trying with PHP to change the JSON...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/9/491d725051f7fe968ddb0d58bb5f4dd3bc2e084f.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [6 May 2022 14:16 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295/7 "2022-05-06T14:16:53Z")

</div>

I'm totally confused. There's a microcontroller, a web server and some device running Node-red.  
PHP is running somewhere too

Your message is received in Node-red, but it is not received wherever you have PHP.

I don't see how an mqtt-in node in Node-red is supposed to make the message available to PHP.

---

<div class="post-metadata">

**Author:** ![themed00](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@themed00](https://discourse.nodered.org/u/themed00)\
**Post date:** [6 May 2022 14:33 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295/8 "2022-05-06T14:33:35Z")

</div>

Thanks 4 your question 🙂 So got a new clew what I can test.

I tried now with nodejs to subscribe to this topic and I can recieve it. So Node Red is not the problem 🙂

The JSON is probably to large or whatever... thanks again for your time and your thoughts.

---

<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:** [20 May 2022 14:33 UTC](https://discourse.nodered.org/t/debug-shows-json-but-mqtt-doesnt-trigger/62295/9 "2022-05-20T14:33:52Z")

</div>

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