Convert to string

pull/4900/head
Ben Hardill 2024-10-08 13:58:29 +01:00
parent e3acc49d5e
commit a0b4fc8372
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
1 changed files with 6 additions and 2 deletions

View File

@ -161,9 +161,13 @@ module.exports = function(RED) {
if(typeof val === "string") {
count++;
_clone[key] = val;
} else if (typeof val === "number") {
} else {
count++;
_clone[key] = val.toString();
try {
_clone[key] = JSON.stringify(val)
} catch (err) {
console.log('MQTT v5 Property value can not be converted to a String')
}
}
});
if(count) properties.userProperties = _clone;