Json - Why?

What is JSON, why do we use it & some important info about it.

Why do we use JSON?

Supreme uses JSON for many reasons, but the primary reasons are for 1. Simplicity for us. It's much faster for us to define a configurable value in a config java class & let our loaders deal with loading it and making sure it's not broken or null. Another reason is speed. Our JSON classes are loaded into memory. Which YML configs are also loaded into memory, they are stored in key-value maps which must be looped throw each time to find the value you want.

How do I reset or delete JSON files?

It's important to remember that JSON files are loaded & stored in memory. When your server stops, the plugin saves all the existing content in memory to disk. This means when you delete your players.json file & then stop your server, the server is going to remake & resave the content of your players.json . You must STOP your server before deleting files or they will just regenerate.

How do I use JSON?

JSON is almost the same as YML. Values in the file are stored as key-value pairs. You'll find a name for a given value like "example": followed by the value 100 . Each JSON statement is followed by a , with the exception of the last value in a given section. We try to ensure that there is a few example objects in each default config before release to allow people to see how the config works & can be changed. It is also a good idea to save a copy of your work while you are working on it. Unlike YML file, you don't get a console error when your config is broken, your entire config is renamed to config.json_bad which indicates that the server couldn't load your file. You can also use online tools like this JSON format check which will not only check your format for issues, but if it does find issues, it tells you exactly where they are & why.

Last updated