Hello,
maybe I'm just too stupid, but I'm trying to send javascript object over mqtt and it doesn't do what i want.
Here is the code from a function node:
msg.payload = {"property":1};
msg.topic = "topic/bla";
return msg;
And this is sent through a mqtt node. The output of the function node is
(Object) { "topic": "topic/bla", "payload": { "property": 1 } }
so everything seems ok. But then, when I look at the distributed message of the mqtt broker, it returns
(Object) { "topic": "topic/bla", "payload": "{\"property\":1}", "qos": 0, "retain": false, "_topic": "topic/bla" }
So instead of sending its json representation of the object, it makes a string with escape characters.
Is there a way of sending json or javascript objects through mqtt?
Thank you!