# Incorrectly formatted json string

**URL:** https://discourse.nodered.org/t/incorrectly-formatted-json-string/58693
**Category:** General
**Tags:** mqtt
**Created:** [20 February 2022 13:27 UTC](https://discourse.nodered.org/t/incorrectly-formatted-json-string/58693 "2022-02-20T13:27:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![GrantWise](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grantwise/32/56986_2.png) [@GrantWise](https://discourse.nodered.org/u/GrantWise)
#### Post date: [20 February 2022 13:27 UTC](https://discourse.nodered.org/t/incorrectly-formatted-json-string/58693/1 "2022-02-20T13:27:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)
#### Post date: [20 February 2022 13:31 UTC](https://discourse.nodered.org/t/incorrectly-formatted-json-string/58693/2 "2022-02-20T13:31:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![GrantWise](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grantwise/32/56986_2.png) [@GrantWise](https://discourse.nodered.org/u/GrantWise)
#### Post date: [20 February 2022 13:33 UTC](https://discourse.nodered.org/t/incorrectly-formatted-json-string/58693/3 "2022-02-20T13:33:44Z")

</div>

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

Appreciate the help

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [20 February 2022 13:48 UTC](https://discourse.nodered.org/t/incorrectly-formatted-json-string/58693/4 "2022-02-20T13:48:36Z")

</div>

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}`

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [6 March 2022 13:48 UTC](https://discourse.nodered.org/t/incorrectly-formatted-json-string/58693/5 "2022-03-06T13:48:43Z")

</div>

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