When working with JavaScript, I am handling an array of objects structured as shown below:
[
{
"fields": {
"assignee": {
"email": "emailid1",
"name": "name1"
}
}
},
{
"fields": {
"assignee": {
"email": "emailid2",
"name": "name2"
}
}
},
{
"fields": {
"assignee": {
"email": "emailid1",
"name": "name1"
}
}
}
]
My goal is to group and count the objects based on their respective email addresses. For the given array of objects, I expect the following result:
emailid1 : 2
emailid2 : 1
I am exploring the possibility of achieving this using underscore.js. While I came across the underscore countby method, I am unsure of how to utilize it in this particular scenario due to the nested object properties.