I'm playing with NodeRed. Esp32 with Tasmota sending mqtt message like following example:
{
"Time": "2021-12-05T20:46:40",
"MJ_HT_V1391ef1": {
"mac": "582d34684ef1",
"Temperature": 22.6,
"Humidity": 50.9,
"DewPoint": 11.9,
"Battery": 100,
"RSSI": -92
},
"MJ_HT_V1385877": {
"mac": "582d31385557",
"Temperature": 22,
"Humidity": 53.3,
"DewPoint": 12,
"Battery": 85,
"RSSI": -86
}
}
Please! How do I get the names MJ_HT_V1391ef1 and MJ_HT_V1385877 without knowing them and also json can have more similar object then only two. Also I will need to get to the information like MJ_HT_V1391ef1.mac or MJ_HT_V1391ef1.Temperature.
If I use something like
var zprava=msg.payload;
msg.payload=zprava["MJ_HT_V1391ef1"]["Temperature"];
It works and I get a value 22.6. But I need to do it more dynamic. Some loop which will go through the json?
I spend almost 5 days with finding solution. Please help me.