[Solved] javascript, put labels in hashmap to conver in json format


You can cycle through your object using a for..in loop, then push objects to an array using it’s keys and values:

var hash =  {"La Coruña":11,"Pamplona":2,"León":9,"Valencia":4,"Las Palmas de Gran Canaria":3,"Oviedo":3,"Salamanca":2,"Albacete":3}
var arr = [];
    
for (var prop in hash) {
  arr.push({'Ciudad': prop,'Clientes': hash[prop]});
}
    
console.log(arr);

1

solved javascript, put labels in hashmap to conver in json format