I have incoming json objects. What i want to do is to filter the JSON based on its key. For example I have three incoming json objects.
Sending message: {"deviceId":"test","temperature":11,"latitude":50,"longitude":19,"time":1,"id":398}
Sending message: {"deviceId":"temp","temperature":11,"latitude":50,"longitude":19,"time":1,"id":399}
Sending message: {"deviceId":"temp","temperature":11,"latitude":50,"longitude":19,"time":1,"id":400}
Sending message: {"deviceId":"test","temperature":11,"latitude":50,"longitude":19,"time":1,"id":01}
Sending message: {"deviceId":"temp","temperature":11,"latitude":50,"longitude":19,"time":1,"id":402}
I want only those json objects where deviceid is test and not temp. I am trying to filter the JSON. How can i do this?
obj.deviceId == 'test'- in this case, the JSON string was parsed to an object calledobj