An inputted array, how do i get just the temperature [0] shown on debug?

Hi,

This flow does work and i can get the temperature [0], but in the debug node it shows ALL msg.payload messages, I just want the temperature [0] value to be in debug ?

I have tried variations of Switch node at the start of the flow with 'has key', but still i get all or nothing.
I prefer using gui nodes if possible, easier for me to understand :grinning:
Thanks

Sent from Arduino to Node-RED

{
"Sensors": [
{
"id": "DS1820_Sensor_01",
"temperature": 24.25,
"humidity": 0,
"location": "PC room",
"information": "Humidity is dummy data"
},
{
"id": "DS1820_Sensor_02",
"temperature": 25,
"humidity": 0,
"location": "PC room"
}
]
}

My flow
[{"id":"d2663d6de10ed7c6","type":"group","z":"37097d1320355ac2","name":"Get part of data from an array","style":{"label":true,"fill":"#ffffbf","fill-opacity":"0.24"},"nodes":["87e6621391303f27","f87a2d4bfac63f54","939a0737a85ab770"],"x":794,"y":869,"w":502,"h":82},{"id":"87e6621391303f27","type":"link in","z":"37097d1320355ac2","g":"d2663d6de10ed7c6","name":"> JSON Data","links":["b770b07d30a4f9b0"],"x":835,"y":910,"wires":[["f87a2d4bfac63f54"]]},{"id":"f87a2d4bfac63f54","type":"change","z":"37097d1320355ac2","g":"d2663d6de10ed7c6","name":"Set only temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.Sensors[0].temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":910,"wires":[["939a0737a85ab770"]]},{"id":"939a0737a85ab770","type":"debug","z":"37097d1320355ac2","g":"d2663d6de10ed7c6","name":"debug 224","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":910,"wires":[]}]

Why do you want that? The debug is just for checking that flows are working correctly.
If you mean that you want that value in msg.payload then you can use a Change node to Move it there. To find the path of the element you want to move then there’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path/value for any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

Looking at your flow and data, if the data is in msg.psyload it should work fine. I suspect the data is not in msg.payload, or msg.payload is an JSON and not an Object. Cant we see the debug set to complete message object please, prior to the change node..

HI Colin,

I always add a debug on the output of all my flows, so i cam isolate them if either I have a problem or want to just see certain flow outputs, i have been doing this for years :grinning:
And it is so helpful

Well i think i have solved it, for each temperature in the JSON object, you only need to match one as a 'switch'
Then use everything as normal and you only get the temperatures data out of debug.

   

   

and

   
and the flow if anyone wants to observe it

type or paste code her[{"id":"482d6deefb3d7b78","type":"group","z":"37097d1320355ac2","name":"Get part of data from an array","style":{"label":true,"fill":"#ffffbf","fill-opacity":"0.24"},"nodes":["fd7eaf06c4062231","d0b543cec0bfa9a7","9c831ef4a4497779","8a50b86e71bfb814","f66b9d09052172a9","48f29e88037cb94b"],"x":514,"y":2519,"w":622,"h":142},{"id":"fd7eaf06c4062231","type":"link in","z":"37097d1320355ac2","g":"482d6deefb3d7b78","name":"> JSON Data","links":["b770b07d30a4f9b0"],"x":555,"y":2590,"wires":[["8a50b86e71bfb814"]]},{"id":"d0b543cec0bfa9a7","type":"change","z":"37097d1320355ac2","g":"482d6deefb3d7b78","name":"Set only temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.Sensors[0].temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":2560,"wires":[["9c831ef4a4497779"]]},{"id":"9c831ef4a4497779","type":"debug","z":"37097d1320355ac2","g":"482d6deefb3d7b78","name":"debug 233","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1020,"y":2560,"wires":[]},{"id":"8a50b86e71bfb814","type":"switch","z":"37097d1320355ac2","g":"482d6deefb3d7b78","name":"","property":"payload.Sensors[0]","propertyType":"msg","rules":[{"t":"hask","v":"temperature","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":650,"y":2590,"wires":[["d0b543cec0bfa9a7","f66b9d09052172a9"]]},{"id":"f66b9d09052172a9","type":"change","z":"37097d1320355ac2","g":"482d6deefb3d7b78","name":"Set only temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.Sensors[1].temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":2620,"wires":[["48f29e88037cb94b"]]},{"id":"48f29e88037cb94b","type":"debug","z":"37097d1320355ac2","g":"482d6deefb3d7b78","name":"debug 235","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1020,"y":2620,"wires":[]}]e

An alternative approach: change the debug node to only display the temperature: