I need to convert a hash map
{ \"fruit\" : [\"mango\",\"orange\"], \"veg\" : [\"carrot\"] }
to
[ { \"type\
I would like to give an "oneline" solution:
var b = Object.keys(a).map(e => { return { type:e, name:a[e] } });
Economy of words at your service. Question asked for translating an object to an array, so I'm not duplicating above answer, isn't it?