I have an array with below list of array as shown in image , I would like to remove the duplicates array "Qualif" and "Prod"
I want to be like that
I have tried with the following conditions
Scenario1 :
this.Default_data_historique=Object.values(this.nouveau_data_historique.reduce((c,e)=>{
if (!c[e.PTF_NAME]) c[e.PTF_NAME] =e; return c; },{}));
Scenario2 :
this.Default_data_historique= Array.from(new Set(this.nouveau_data_historique))
Scenario3 :
this.Default_data_historique=this.nouveau_data_historique.filter(function(elem,index,self){
return index === self.indexOf(elem)
});
None of the three scenarios above were able to remove the duplicates from that array. Could any one please help on this ?
Edit: sample data i have
[
[{
"PTF_NAME": "integration",
"Salle": "salle1"
},
{
"PTF_NAME": "integration",
"Salle": "salle1"
}
],
[{
"PTF_NAME": "Qualif",
"Salle": "salle1"
},
{
"PTF_NAME": "Qualif",
"Salle": "salle1"
}
],
[{
"PTF_NAME": "Qualif",
"Salle": "salle2"
},
{
"PTF_NAME": "Qualif",
"Salle": "salle2"
}
],
[{
"PTF_NAME": "Prod",
"Salle": "salle1"
},
{
"PTF_NAME": "Prod",
"Salle": "salle1"
}
],
[{
"PTF_NAME": "Prod",
"Salle": "salle2"
},
{
"PTF_NAME": "Prod",
"Salle": "salle2"
}
]
]
what i want
[
[{
"PTF_NAME": "integration",
"Salle": "salle1"
},
{
"PTF_NAME": "integration",
"Salle": "salle1"
}
],
[{
"PTF_NAME": "Qualif",
"Salle": "salle1"
},
{
"PTF_NAME": "Qualif",
"Salle": "salle1"
}
],
[{
"PTF_NAME": "Prod",
"Salle": "salle1"
},
{
"PTF_NAME": "Prod",
"Salle": "salle1"
}
]
]