I have this object / array in flowContext named dig2
:
{"registry":
[
{ "Catid" : "Air-1a",
"Name" : "Air",
"ValueName" : "Humidity",
"Loc" : "North Quad"},
{ "thing_id" : "Irr-6",
"Name" : "Irrigation",
"ValueName" : "Auto",
"Loc" : "Garden"}
]
}
With a Change node, using JSONata expression below, it selects only the 2nd object, and sends to msg.payload:
$flowContext('dig2.registry')[ Name = 'Irrigation' ]
But, I would like to use an incoming msg.payload before the change node to do the selection, neither of below 2 JSONata statements works, any ideas?
$flowContext('dig2.registry')[ Name = payload ]
or
$flowContext('dig2.registry')[ Name = $.payload ]
Per other reported posts, I have also tried payload.[0]
, payload.[1]
, and payload."1"
- also not working?