Incorrectly formatted json string

Hi, I am very new to node-red and MQTT so the problem that I have found has taken me a while to pin down. I have a device that is logging the temperature on 3 channels, currently I only have 1 working, which I want to log into a InfluxDb.

The problem that I have is that the message that the device is returning is incorrectly formatted, see below, the last "false" is missing the "e" which is causing a problem.
{"n_channels":4,"n_alarms":10,"timestamp":1645370661,"battery":5.89,"value_channels":[0.0,0.0,28.1,0.0],"alarms":[false,false,false,false,false,false,false,false,false,false],"buzzer_state":fals}

I have contacted the manufacturer hoping that they can update the firmware but I am not holding my breath. Is there a way that I can just correct the string by inserting the "e".

Thanks

You can just use a change node as long as this remains a string and replace fals to false.

Thanks, after reading some of the other discussions I have just found something similar and change has worked.

Appreciate the help

For information purposes only.

Replacing "fals" with "false" does not appear to be the correct solution.
output -
{"n_channels":4,"n_alarms":10,"timestamp":1645370661,"battery":5.89,"value_channels":[0.0,0.0,28.1,0.0],"alarms":[falsee,falsee,falsee,falsee,falsee,falsee,falsee,falsee,falsee,falsee],"buzzer_state":false}

but if you replace "fals}" with "false}"
output-
{"n_channels":4,"n_alarms":10,"timestamp":1645370661,"battery":5.89,"value_channels":[0.0,0.0,28.1,0.0],"alarms":[false,false,false,false,false,false,false,false,false,false],"buzzer_state":false}

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.