I have json data below
var dataA = {
"state":"TX",
"city":"Dallas",
"code":"75201",
"totalareas":"75201",
"website":"asdf.ccom"
}
and I have an array of objects
var dataB =[
{
"key":"state",
"value":"TX"
},
{
"key":"city",
"value":"Dallas"
},
{
"key":"yu",
"value":"2"
},
{
"key":"website",
"value":"asdf.ccom"
}
]
I want to compare this dataA and dataB and get only matched fields with object how can I do this
My expectation result
{
"city":"Dallas",
"state":"TX",
}