Change node brain fart

My device puts out this. A debug node says this is a string.

{"endpoint":{"serial_number":"142d41fffe3842f9"},"payload":{"temperature":{"temperature":12.1}}}

I can send it in/out MQTT and extract the number with a change node (as it becomes an object), but if I treat it like a string in a change node It fails. What am I missing? I must be misunderstanding the change node.
Thanks

What does that mean?

What are you doing and how exactly does it "fail"?

Does whatever node you are using to import this into Node-red have the option to import as a parsed json object?

I try delete everything before and after the number (change node & 2 rules replacing front and back with empty) and I only delete the end bit every time.

no, it's quite a new device. Maybe they'll add that option.

Sorry, very unclear (to me).

Perhaps a screen shot, an example flow with actual data to demonstrate what you mean and what you are hoping to achieve would help?

unfortunately deleted original flow. This is what I am trying currently. I think it works but I'm turning


it into an object. The switch nodes are because I don't trust it. It puts out host device security state changes too. Hi

Have you tried sending it through a JSON node, which should convert it to an object if it is valid JSON?

Edit: Oh, you are sending it through a JSON node. I suggest you do that immediately on getting the data, then you can work with it as an object which should make the whole thing easier. The MQTT Out node will be happy with it as an object.

I wasn't. Turning it into an object was a get around that worked. I was trying (and failing) to parse the string without programming.

I would not describe it as a get around, I would describe it as the best way to do it.

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