# MQTT Engine module JSON payload parse error

**URL:** <https://forum.inductiveautomation.com/t/mqtt-engine-module-json-payload-parse-error/44692>\
**Category:** Maker\
**Created:** [March 19, 2021, 4:44pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-module-json-payload-parse-error/44692 "2021-03-19T16:44:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscar.salcedo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscar.salcedo/32/11019_2.png) [@oscar.salcedo](https://forum.inductiveautomation.com/u/oscar.salcedo)\
**Post date:** [March 19, 2021, 4:44pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-module-json-payload-parse-error/44692/1 "2021-03-19T16:44:34Z")

</div>

Ignition Maker Edition Version: 8.1.2 (b2021020311)  
MQTT Engine Module 4.0.6 (b2020111920)  
Mosquitto 2.0.7

I am having an issue reporting certain topics via MQTT Engine into Ignition. I am running a mosquitto broker and have 4 relays connected to it and reporting status, as well as commanding the relay ON/OFF (I am using SONOFF relays with Tasmota firmware - [MQTT - Tasmota](https://tasmota.github.io/docs/MQTT/))

I have configured the MQTT Engine module to connect to my broker, and I have a custom namespace that points to the “home/lab/#” topic – configured to parse as JSON. Here is the module configuration:

 ![1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/9/59785fee1a7eac64aca307c97086a3f92d5d8f17.png)  
 ![2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/4/446658481771e16802d2c337ddb2588b4fbd84af.png)  
 ![3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/8/c8c7aff33e329c1371eef58bb2bc08a983a4ba16.png)

I can see most of the topics in the tag browser:  
 ![4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/a/7aa9283652796b024a4b3c919692cc73e9d4c5ba.png)

However, when I turn the relay ON or OFF (by publishing a value of “0”, “OFF”, “1”, or “ON” to the topic /home/lab/relays/relay1/cmnd/POWER”, the following error message appears in the log:

 ![5](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/d/add904f4ad0bd4971cd611a03816b159b70f0c6d.png)

The relay triggers just fine, but the error message appears in the log, and the …/cmnd/POWER topic does not show on the tag browser.

Here’s a screenshot of a client directly against the broker:

 ![6](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/a/4aa211b44273ab139fd97d32bc524c2b0362e43b.png)

Thanks,  
Oscar.

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [March 19, 2021, 5:04pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-module-json-payload-parse-error/44692/2 "2021-03-19T17:04:10Z")

</div>

What’s the exact JSON string you’re publishing to `/home/lab/relays/relay1/cmnd/POWER`? I suspect it doesn’t meet the JSON spec perfectly in some way that your SONSOFF relays don’t care about but Ignition does.

---

<div class="post-metadata">

**Author:** ![oscar.salcedo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscar.salcedo/32/11019_2.png) [@oscar.salcedo](https://forum.inductiveautomation.com/u/oscar.salcedo)\
**Post date:** [March 19, 2021, 8:41pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-module-json-payload-parse-error/44692/3 "2021-03-19T20:41:40Z")

</div>

> [@justin.brzozoski](#):
>
> What’s the exact JSON string you’re publishing to `/home/lab/relays/relay1/cmnd/POWER` ? I suspect it doesn’t meet the JSON spec perfectly in some way that your SONSOFF relays don’t care about but Ignition does.

The Sonoff will take any combination of 0/ON, 1/OFF, 2/TOGGLE. When I use 0/1/2, ignition will report correctly on the .../cmnd/POWER topic, but not when using the ON/OFF/TOGGLE strings - because they are not JSON-formatted it looks like.  
when reporting status changes on topic "home/lab/relays/stat/relay2/RESULT", the payload is {"POWER":"OFF"}, and ignition can report the topic change correctly.

For now, I have set the namespace to not parse the payload as JSON, that seems to allow all topics to show in the tag browser, although I don't have the granularity of all nodes downstream.

I can see if the Tasmota firmware can be set to always reply with JSON-formatted payloads.

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [March 19, 2021, 8:44pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-module-json-payload-parse-error/44692/4 "2021-03-19T20:44:34Z")

</div>

It might be something simple like single-vs-double quotes. You’re only supposed to use double-quotes (") in JSON, but many implementations will accept single-quotes (’). In other words the difference between these two lines:

```auto
{“POWER”:“OFF”}
{“POWER”:'OFF'}

```

Subtle, but only the first is proper JSON.
