I can\'t find a similar question and I\'m a bit stuck. I have the following JSON array:
[
{
\"Name\": \"element1\",
\"Attributes\": [\"1\
var uniqueArr = [];
var arr = [
{
"Name": "element1",
"Attributes": ["1", "2"]
},
{
"Name": "element2",
"Attributes": ["1","3" ]
},
{
"Name": "element3",
"Attributes": []
}
];
arr.forEach(function(obj) {
var attr = obj.Attributes;
attr.forEach(function(val){
if (uniqueArray.indexOf(val) < 0) {
uniqueArray.push(val)
}
});
})