Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
I am trying to figure out how to get a JSON payload to properly publish to my MQTT Broker. I am able to generate JSON using the examples from Codesys, but when I send that payload via MQTT there are characters that are extra or not recognized by my MQTT client. Any idea what could be causing it?
your are sending as a WSTRING which is UTF16, but your receiver is interpriting as UTF8. Change the receiver to use UTF16, or better change your sender to convert to UTF8.
You publish the entire storage space (SIZEOF) Instead of the number of bytes of actual text (StrLenA)
I am trying to figure out how to get a JSON payload to properly publish to my MQTT Broker. I am able to generate JSON using the examples from Codesys, but when I send that payload via MQTT there are characters that are extra or not recognized by my MQTT client. Any idea what could be causing it?
try using
and change your publish to
Thanks for the help! Everything now works as expected.
Thanks for the help! Everything now works as expected.
Thanks for the help! Everything now works as expected.