{
"10": {
"name": "The Name",
"count": "4"
},
"9": {
"name": "Some name",
"count": "7"
}
...
"1": {
"name": "Bla bla",
"count": "6"
}
}
const sortedData = Object
.entries(data)
.map(([ key, val ]) => ({ ...val, id: key }))
.sort((a, b) => b.id - a.id);