Hi,
I have an json payload where data is organised inside an array and I want to obtain a value from one of the positions. since it is inside an array I need to filter the position that I want using a predicate. But I didn't find a working solution for this.
I am sending an JSON example below. I was trying to use a change node with a path like msg.payload.consumption[measurementType="total-consumption"].wNow but it doesn't work.
Any suggestions on how this could be achived?
JSON:
{
"consumption": [
{
"type": "eim",
"activeCount": 1,
"measurementType": "total-consumption",
"readingTime": 1623014333,
"wNow": 471.878,
"whLifetime": 64459558.361,
"varhLeadLifetime": 22337648.955,
"varhLagLifetime": 12438387.289,
"vahLifetime": 67290585.179,
"rmsCurrent": 6.355,
"rmsVoltage": 688.198,
"reactPwr": -1234.527,
"apprntPwr": 4373.194,
"pwrFactor": 0.11,
"whToday": 28270.361,
"whLastSevenDays": 216088.361,
"vahToday": 32730.179,
"varhLeadToday": 13200.955,
"varhLagToday": 7067.289
},
{
"type": "eim",
"activeCount": 1,
"measurementType": "net-consumption",
"readingTime": 1623014333,
"wNow": 476.109,
"whLifetime": 43014212.263,
"varhLeadLifetime": 22337561.058,
"varhLagLifetime": 6528732.71,
"vahLifetime": 67290585.179,
"rmsCurrent": 5.533,
"rmsVoltage": 688.309,
"reactPwr": -1073.666,
"apprntPwr": 1267.139,
"pwrFactor": 0.38,
"whToday": 0,
"whLastSevenDays": 0,
"vahToday": 0,
"varhLeadToday": 0,
"varhLagToday": 0
}
]
}
Thanks in advance,
Norberto