Suppose I have an array of object,
const details = [{
"error": true,
"errorDetails": [{
"Information Missing": true,
"Alignment Issue": false,
"Unreadable Invoice": true,
"Line Item Missing": false,
"Master Data Not Found": false
}]
},
{
"error": false,
"errorDetails": [{
"Information Missing": false,
"Alignment Issue": false,
"Unreadable Invoice": false,
"Line Item Missing": false,
"Master Data Not Found": false
}]
},
{
"error": true,
"errorDetails": [{
"Information Missing": true,
"Alignment Issue": true,
"Unreadable Invoice": true,
"Line Item Missing": true,
"Master Data Not Found": false
}]
}
]
var result = details.filter(detail => detail.error == true); //o/p gives only true objects,
console.log(result)
I want to have a count of "Information Missing", "Alignment Issue", "Unreadable Invoice", "Line Item Missing", "Master Data Not Found" when they are true, like: [{"Information Missing" : Number,"Unreadable Invoice" : Number}]