Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Post Timeline

Post Reopened by Alon Eitan, Community Bot, Prafulla Kumar Sahu
Post Closed as "Duplicate" by sideshowbarker javascript Users with the javascript badge or a synonym can single-handedly close questions as duplicates and reopen them as needed.
added 13 characters in body
Source Link
Sajeeb Ahamed
  • 6.4k
  • 2
  • 23
  • 36

I have an array of objectobjects as myData which consists of the below JSON structure:

{ "myData": [ { "Type": "REAL", "Tenure": "12", "Name": "WEBPAGE" }, { "Type": "REAL", "Tenure": "24", "Name": "SERVER" }, { "Type": "REAL", "Tenure": "12", "Name": "WEBPAGE" } ] }

const data = {
 myData: [
 { Type: 'REAL', Tenure: '12', Name: 'WEBPAGE' },
 { Type: 'REAL', Tenure: '24', Name: 'SERVER' },
 { Type: 'REAL', Tenure: '12', Name: 'WEBPAGE' },
 ],
};

I want to get rid of duplicate entiresentries by keeping performance in mind as this array could be of length 1000+ using Javascript.

The Expected Output that I am looking for is as follow since myData[0] && myData[2] are duplicate here:

{ "myData": [ { "Type": "REAL", "Tenure": "24", "Name": "SERVER" }, { "Type": "REAL", "Tenure": "12", "Name": "WEBPAGE" } ] }

const result = {
 myData: [
 { Type: 'REAL', Tenure: '24', Name: 'SERVER' },
 { Type: 'REAL', Tenure: '12', Name: 'WEBPAGE' },
 ],
};

I have an array of object as myData which consists of below JSON structure:

{ "myData": [ { "Type": "REAL", "Tenure": "12", "Name": "WEBPAGE" }, { "Type": "REAL", "Tenure": "24", "Name": "SERVER" }, { "Type": "REAL", "Tenure": "12", "Name": "WEBPAGE" } ] }

I want to get rid of duplicate entires by keeping performance in mind as this array could be of length 1000+ using Javascript.

The Expected Output that I am looking for is as follow since myData[0] && myData[2] are duplicate here:

{ "myData": [ { "Type": "REAL", "Tenure": "24", "Name": "SERVER" }, { "Type": "REAL", "Tenure": "12", "Name": "WEBPAGE" } ] }

I have an array of objects as myData which consists of the below JSON structure:

const data = {
 myData: [
 { Type: 'REAL', Tenure: '12', Name: 'WEBPAGE' },
 { Type: 'REAL', Tenure: '24', Name: 'SERVER' },
 { Type: 'REAL', Tenure: '12', Name: 'WEBPAGE' },
 ],
};

I want to get rid of duplicate entries by keeping performance in mind as this array could be of length 1000+ using Javascript.

The Expected Output that I am looking for is as follow since myData[0] && myData[2] are duplicate here:

const result = {
 myData: [
 { Type: 'REAL', Tenure: '24', Name: 'SERVER' },
 { Type: 'REAL', Tenure: '12', Name: 'WEBPAGE' },
 ],
};
Source Link

Removing duplicates fromarray of objects

I have an array of object as myData which consists of below JSON structure:

{ "myData": [ { "Type": "REAL", "Tenure": "12", "Name": "WEBPAGE" }, { "Type": "REAL", "Tenure": "24", "Name": "SERVER" }, { "Type": "REAL", "Tenure": "12", "Name": "WEBPAGE" } ] }

I want to get rid of duplicate entires by keeping performance in mind as this array could be of length 1000+ using Javascript.

The Expected Output that I am looking for is as follow since myData[0] && myData[2] are duplicate here:

{ "myData": [ { "Type": "REAL", "Tenure": "24", "Name": "SERVER" }, { "Type": "REAL", "Tenure": "12", "Name": "WEBPAGE" } ] }

lang-js

AltStyle によって変換されたページ (->オリジナル) /