Hi there,
I have some JSON data which I want to filter using the Switch node, but I am not being succesful. The JSON is this:
{
"payload": {
"deviceAddress": 111,
"timestamp": "2022-03-06T21:19:17",
"temperature": 22,
"sequence": 545455
}
}
The "payload.deviceAddress" can have many different values, and I need to be able to filter only one specific value (specified in the switch node).
Here is the test nodes I have setup (started with a simple switch and played with JSonata also but no luck):
[{"id":"b7eda5e281bbca49","type":"debug","z":"8f0861c83fb387a2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":730,"y":240,"wires":[]},{"id":"dbfebcda3dfb4e1d","type":"switch","z":"8f0861c83fb387a2","name":"Filter 999","property":"payload.deviceAddress","propertyType":"jsonata","rules":[{"t":"eq","v":"\"999\"","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":400,"y":320,"wires":[["b7eda5e281bbca49"]]},{"id":"298bbde330e1b5e7","type":"inject","z":"8f0861c83fb387a2","name":"Inject 111","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"payload\":{\"deviceAddress\":111,\"timestamp\":\"2022-03-06T21:19:17\",\"temperature\":22,\"sequence\":545455}}","payloadType":"json","x":160,"y":240,"wires":[["b7eda5e281bbca49"]]},{"id":"73fca0466488bd92","type":"inject","z":"8f0861c83fb387a2","name":"Inject 999","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"payload\":{\"deviceAddress\":999,\"timestamp\":\"2022-03-06T21:19:17\",\"temperature\":22,\"sequence\":545455}}","payloadType":"json","x":160,"y":320,"wires":[["dbfebcda3dfb4e1d"]]}]