Вы можете извлечь значения входного объекта через Object.values()
, а затем map()
name
из каждого значения object
, как показано ниже, для достижения этого:
const data = {
barID1: {
address: "4 East Terrace, Sydney NSW 2000",
appStoreURL: "http://itunes.apple.com/app/idXXXXXXXXX",
description: "description text",
imgURLs: [ "Https:url1", "https:url2", "https:url3" ],
lat: -34.810585,
lon: 138.616739,
name: "Africola",
phone: "(08) 8223 3885",
status: "active",
venueImgURL: "https:url"
},
barID2: {
address: "138/140 Gouger St, Sydney NSW 2000",
appStoreURL: "http://itunes.apple.com/app/idXXXXXXXXX",
description: "description text",
imgURLs: [ "Https:url1", "https:url2", "https:url3" ],
lat: -34.848082,
lon: 138.599813,
name: "Disco Mexico Taqueria",
phone: "0416 855 108",
status: "active",
venueImgURL: "https:url"
}
}
console.log( Object.values(data).map(object => object.name) )