Should I save my data as JSON?

I usually save data as JSON when writing to Datastores, however this time I would like to make a globally ranked leaderboard. If I’m not mistaken roblox has a function to list global player data ascending/descending depending on what the user wants. Is it possible to do this while still saving everything as JSON?

Why would you save it as a JSON? Roblox already does this for you so you don’t need to do this yourself.

Doesn’t all data stores get converted to JSON automatically? that’s the only way they can really save it…

Since I am working with many variables, I write all my data as a JSON string so I can send essentially a single packet to save to avoid throttling, it allows me to save more often + have backups.

You don’t need to encode it to all JSON to do that. Not sure what you mean either.

By pre-encoding it beforehand, the saved value is encoded twice which takes up more space in the data stores.

For instance, an empty table would be encoded as


but since it is getting encoded again it is a string, so it gets encoded again.


which takes 2x more space. This is even more problematic with strings since they need to be escaped. For instance a table

    cool = "awesome"

would become


but since that gets encoded again it becomes


This is why I do it the way I do (fewer requests):


But anyway that’s not my issue, I guess the only solution would just be to exclude the leaderboard data from the JSON string and save it on its own.