Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove duplicate json object from array javascript

const temp =  [{first: 569, second: "789", third: "458"},  {first: 476, second : "147", third: "369"},  {first: 100, second: "200", third: "300"},  {first: 100, second: "200", third: "300"},   {first: 100, second: "200", third: "300"}];

const result = [...new Set(temp.map(obj => JSON.stringify(obj)))]
                 .map(str => JSON.parse(str));
console.log(result);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #duplicate #json #object #array #javascript
ADD COMMENT
Topic
Name
1+1 =