I have the following json line:
{
"Alarm":{
"Hello":48,
"World":3,
"Orange":1
},
"Rapid":{
"Total":746084,
"Fake":20970,
"Cancel":9985,
"Word": 2343
},
"Flow":{
"Support":746084,
"About":0,
"Learn":0
}
}
Then I load the above line and convert it to an object json:
jsonStr = '{"Alarm":{"Hello":48,"World":3,"Orange":1},"Rapid":{"Total":746084,"Fake":20970,"Cancel":9985},"Flow":{"Support":746084,"About":0,"Learn":0}}';
var jsonObj = JSON.parse(jsonStr);
Now, how can I filter this object jsonby key name? for example, If the filter was "ange", the filtered object:
{
"Alarm":{
"Orange":1
}
}
If the filter was "flo", the filtered object will look like this:
{
"Flow":{
"Support":746084,
"About":0,
"Learn":0
}
}
And if the filter was "wor", the result would be:
{
"Alarm":{
"World":3,
},
"Rapid":{
"Word": 2343
}
}
Is it possible to achieve this filtering using a method filter? Any advice would be appreciated.