Rank and Leaderboard

Hello there,
I have followed a tutorial to make a Discord bot have an XP and Level System (https://www.youtube.com/watch?v=1A14eyfh8Fs) however I was wondering if there was a way it could also give you rank (based on your XP (e.g. if user1 had 20XP and user2 had 30XP than user2 would be rank 1 and user1 would be rank 2)) If anyone could help me make this I would be thrilled! I assume you would need to sort it and then find what number it is. In theory, it would save this number to the JSON file. Would I also be able to make a leaderboard command (I tried sorting the JSON file but it didn’t work)? This is what the code makes in the JSON file: http://codebin.herokuapp.com?s=5e9192f08ec1390004000001 The first number is the User ID
Edit: This is a very similar question to Discord Level Leaderboards, which may help you to understand my question a bit more