[
{
"Data": [
{
"name": "Sony",
"color": "black"
}
]
},
{
"Data": [
{
"name": "Apple",
"color": "white"
}
]
},
{
"Data": [
{
"name": "Sony",
"color": "red"
}
]
}
]
['Sony', 'Apple', 'Sony']
. var names = arr.map(e=>e.Data[0].name);
var counter = names.filter((v,i,arr)=> arr.indexOf(v) === i).map(el=>{
return {"name":el,"count" :names.filter(e=>el == e).length }
});
console.log(names)
console.log(counter)
["Sony", "Apple", "Sony"]
[{
count: 2,
name: "Sony"
}, {
count: 1,
name: "Apple"
}]