thomasnordquist / MQTT-Explorer

An all-round MQTT client that provides a structured topic overview
https://mqtt-explorer.com
Other
2.86k stars 282 forks source link

Incorrect display of long and complex JSON payload #803

Closed lindhe closed 1 month ago

lindhe commented 1 month ago

MQTT Explorer version: 0.4.0-beta4

During some debugging I found that MQTT Explorer seems to struggle with some JSON payloads.

$ mosquitto_sub -h mqtt.example.com -p 1883 -t 'homeassistant/binary_sensor/Nexa-Security-3-7559323-state/config'
{"stat_t":"+/+/RTL_433toMQTT/Nexa-Security/3/7559323","name":"State","uniq_id":"Nexa-Security-3-7559323-state","val_tpl":"{{ value_json.state | is_defined }}","pl_on":"ON","pl_off":"OFF","device":{"ids":["Nexa-Security-3-7559323"],"cns":[["mac","Nexa-Security-3-7559323"]],"mdl":"Nexa-Security","name":"Nexa-Security-3-7559323","via_device":"OMG_1"}}

In MQTT Explorer, it looks like this:

{"uuid":"ac\",\"Nexa-Security-3-7559323\"]],\"mdl\":\"Nexa-Security\",\"name\":\"Nexa-Security-3-7559323\",\"via_device\":\"OMG_1\"}}"}

MQTT Explorer

I tried to find a MWE, this is the best I could come up with:

$ mosquitto_pub -h mqtt.lindhe.io -p 1883 -t debug/foo -m '{"stat_t":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaa":"aaaaa","aaaaaaa":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaa","val_tpl":"{{ value_json.state | is_defined }}","aaaaa":"aa","aaaaaa":"aaa","aaaaaa":{"aaa":["aaaaaaaaaaaaaaaaaaaaaaa"],"aaa":[["mab","aaaaaaaaaaaaaaaaaaaaaaa"]],"aaa":"aaaaaaaaaaaaa","aaaa":"aaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaa":"aaaaa"}}'

Some notes:

thomasnordquist commented 1 month ago

There was an issue with the Sparkplug implementation. Ther is a more recent beta which fixes it. Sparkplug will be re-added later this week.