I have such an Object freq = { a: 50, r: 25, m: 25 } I want to convert it to this Array-Object like thing
freq = { a: 50, r: 25, m: 25 }
You could take the entries of the object and take a destructuring assignment for the key/value pairs and map new objects with short hand properties.
var freq = { a: 50, r: 25, m: 25 }, dps = Object.entries(freq).map(([label, y]) => ({ label, y })); console.log(dps);