I have requirement where I need to check duplicates for object items.
In the below Array of object, I need to check for "empno" OR "extension" and If there are any duplicates then I need to throw an error.
I have tried this Stack Overflow link but it didn't work for me.
[
{
"id": 269,
"empno": "34567",
"extension": 345
},
{
"id": 269,
"empno": "34568",
"extension": 346
},
{
"id": 269,
"empno": "34569",
"extension": 345
},
{
"id": 269,
"empno": "34567",
"extension": 345
}
]