How to split the payload? temp and pressure values from JSON string (from aws)

Hey everybody

I get that message on the debug:

What I really want is to know how to split the values of temp and pressure. Is needed a function? If yes, what's the code?
I've read user-guide/messages link but didnt get a conclusion.

The dashboard will stay simple like this:

Really appreciated!

Try:

But which nodes I connect with? I've got an inject node with the values that comes from mqtt then I connect it to a function node and then to the mqtt output node?

The screenshot you posted today shows that your data is a string because of the return characters you have in it (the arrows)
The best thing to do would be to make sure they are removed before you send . Then the MQTT node should be able to convert the message into a javascript object and you will then be able to display it properly.

So you're saying I should get, like the first screenshot, Temp: "25" (object) rather than "Temp": "25" (string) ?

You need it as a javascript object in Node-RED. Given that's what you in the first post I'd suggest changing back to what you had first,
If you are sending via MQTT the MQTT node with automatically convert a JSON string into a javascript object. Currently it isn't doing that because of the carriage returns

1 Like

I'll change it back for what I did first and after that, the split can be done with a function node or a change node? Cause I just want to put the temperature on a gauge and the pressure on another.

If you are sending a valid JSON message through the MQTT node will convert it to a javascript object.
There should be no need for a split node.

You can the use a debug be to find the correct path to the data you want to visualise. The “working with messages” page in the docs will show you how (see @bakman2 reply…)

If you don’t understand javascript objects it is worth working through an online tutorial as it’s fundamental for working with Node-RED