i want to filter the following object
Provided Input
{
"-Ms0hh73q83B7mlmlioU":{
"address":"House#1",
"contact":"999-999-999",
"history":{
"0":{
"date":"28 Dec 2021"
},
"-Ms0hirc8slZ8-UsHU5Z":{
"date":"28 Dec 2021"
}
},
"name":"John"
},
"-Ms0hnbp2Nyu-HHonYdj":{
"address":"House#2",
"contact":"123-123-123",
"history":{
"0":{
"date":"28 Dec 2021"
},
"-Ms0hoVTDDJdL-KzpIu5":{
"date":"28 Dec 2021"
}
},
"name":"Bill"
}
}
I want to filter it on name = "John" and want the following output.
Required Output
{
"-Ms0hh73q83B7mlmlioU":{
"address":"House#1",
"contact":"999-999-999",
"history":{
"0":{
"date":"28 Dec 2021"
},
"-Ms0hirc8slZ8-UsHU5Z":{
"date":"28 Dec 2021"
}
},
"name":"John"
},
How can i filter this object to achieve my goal?