1.9.2 • Published 6 years ago
json-mqtt-serializer v1.9.2
Small helper to serialize json to MQTT topics
see the tests for detail of the formatting options
Example usage:
const mqttSerializer = require("json-mqtt-serializer")
const bunchOfObjects = {
a: [
"b",
{c: "abc"}
],
d: "def"
}
const result = mqttSerializer(bunchOfObjects, "exampleNameSpace/")
Will return
[
{topic: "exampleNameSpace/a/0", message: "b"},
{topic: "exampleNameSpace/a/1/c", message: "abc"},
{topic: "exampleNameSpace/d", message: "def"}
]