// remove duplicates objects from an array of objects using javascript
let arr = [
{id: 1, name: 'Chetan'},
{id: 1, name: 'Chetan'},
{id: 2, name: 'Ujesh'},
{id: 2, name: 'Ujesh'},
];
let jsonArray = arr.map(JSON.stringify);
console.log(jsonArray);
/*
[
'{"id":1,"name":"Chetan"}',
'{"id":1,"name":"Chetan"}',
'{"id":2,"name":"Ujesh"}',
'{"id":2,"name":"Ujesh"}'
]
*/
let uniqueArray = [...new Set(jsonArray)].map(JSON.parse);
console.log(uniqueArray);
/*
[ { id: 1, name: 'Chetan' }, { id: 2, name: 'Ujesh' } ]
*/