{
name: 'Name 1',
city: 'city 1',
developer: 'dev 1',
},
{
name: 'Name 2',
city: 'city 2',
developer: 'dev 2',
},
{
name: 'Name 3',
city: 'city 1',
developer: 'dev 3',
},
var cities = [{
name: 'Name 1',
city: 'city 1',
developer: 'dev 1',
},
{
name: 'Name 2',
city: 'city 2',
developer: 'dev 2',
},
{
name: 'Name 3',
city: 'city 1',
developer: 'dev 3',
}];
var result = _.uniqBy(cities, 'city');
console.log(result);
// то что вы предоставили это не JSON...
const data = [
{ "name": "Name 1", "city": "city 1", "developer": "dev 1" },
{ "name": "Name 2", "city": "city 2", "developer": "dev 2" },
{ "name": "Name 3", "city": "city 1", "developer": "dev 3" }
];
const cities = new Set();
JSON.parse(JSON.stringify(data)).forEach(item => {
cities.add(item.city)
});
console.log(cities); // {"city 1", "city 2"}