[{'id':1, 'name':'John', 'collection':'boston'},
{'id':2, 'name':'Faer', 'collection':'antler'},
{'id':3, 'name':'klei', 'collection':'aqua'},
{'id':4, 'name':'Inda', 'collection':'boston'},
{'id':5, 'name':'Faer', 'collection':'antler'}];
const collections = []
for (let i = 0; i < data.length; i++) {
if (!collections.includes(data[i].collection)) {
collections.push(data[i].collection);
}
}
const collections = Array.from(new Set(data.map(d => d.collection)));
const collections = Object.keys(data.reduce((res, next) => {
res[next.collection] = null;
return res;
}, {}));
const collections = data.reduce((res, next) => {
if (!res.includes(next.collection)) {
res.push(next.collection);
}
return res;
}, {});
var json = [{'id':1, 'name':'John', 'collection':'boston'},
{'id':2, 'name':'Faer', 'collection':'antler'},
{'id':3, 'name':'klei', 'collection':'aqua'},
{'id':4, 'name':'Inda', 'collection':'boston'},
{'id':5, 'name':'Faer', 'collection':'antler'}];
var result = new Set();
for (var i = 0; i < json.length; i++) {
result.add(json[i].collection);
}
console.log(result);