Discord Level Leaderboards

Hi everyone, im making a level up bot using JSON database. I want my bot to look at the file find all the levels and organize them from the highest levels to the lowest levels

The database works like this

database[message.author.id] = {
 xp: xp,
 level: level

Thanks in advance!