score:1

Accepted answer

You could map the entries of the object to get the data array

const input = {
  test1: 38,
  test2: 2,
  test3: 160
}

const data = Object.entries(input)
                   .map(([name, y]) => ({ name, y }))

console.log(data)

const chart = {
  series: [{
    name: 'Success',
    data
  }]
}

console.log(chart)


Related Query

More Query from same tag