How to extract value from array/object?

First to say hello!

I want to "extract" only the value data from an array/object.
It's a capacity measurement from my solar battery, I need to sent the value only via MQTT.
I'm now sending "col28: 260.00", but I need to sent only the value "260.00".
I tried with an "change" function to set the msg.payload to "msg.payload.0.col28.Value[0]" as suggested on other thread I found with similar problem, but doesn't work, tried also every other combination like "msg.payload.col28.Value", etc...
I have read the messages documentation, but there I can't find anything similar.

t2 t1

1 Like

Try msg.payload[0].col28 as the array is msg.payload and the object is one layer down as an index of the array.

That worked from the first try and now I'm sending the Value only, thank you so much, I was close to give up since I was trying this by myself for a few days... JGKK special thanks :slight_smile:

Well worth checking out Working with messages : Node-RED
for how to find/reach various parts of messages.

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