Useage
// >= 1.21.11
public static ConfigClassHandler<Config> HANDLER = ConfigClassHandler.createBuilder(Config.class)
.id(Identifier.fromNamespaceAndPath(MOD_ID, "config"))
.serializer(config -> FastJsonConfigSerializerBuilder.create(config)
.setPath(YACLPlatform.getConfigDir().resolve("modid.json"))
.build())
.build();
// <= 1.21.10
public static ConfigClassHandler<Config> HANDLER = ConfigClassHandler.createBuilder(Config.class)
.id(ResourceLoccation.fromNamespaceAndPath(MOD_ID, "config"))
.serializer(config -> FastJsonConfigSerializerBuilder.create(config)
.setPath(YACLPlatform.getConfigDir().resolve("modid.json"))
.build())
.build();
JSON5
FastJSON2 doesn't offer any support for JSON5. If you need/want JSON5 for any reason, I would suggest continuing to use YACL's built-in Gson serializer. If you are migrating from a Json5 config back to a regular Json here is an example of how to auto migrate your user's configs from my mod Am I Up To Date?:
Example
// Replace file & field names with your mod's
public class ConfigMigration {
public static void migrate(){
try {
if (Files.exists(Path.of(YACLPlatform.getConfigDir() + "/aiutd.json5"))){
AIUTD.LOG.info("Pre-2.5.0 config found. Migrating...!");
String JSONContent = Files.readString(Path.of(YACLPlatform.getConfigDir() + "/aiutd.json5"));
JSONObject oldConfig = JSON.parseObject(JSONContent, JSONReader.Feature.AllowUnQuotedFieldNames);
Config.HANDLER.load();
Config.menuAlert = Boolean.parseBoolean(oldConfig.getString("menuAlert"));
Config.chatAlert = Boolean.parseBoolean(oldConfig.getString("chatAlert"));
Config.multiLoaderBool = Boolean.parseBoolean(oldConfig.getString("multiLoaderBool"));
Config.multiLoader = Config.LoaderEnum.valueOf(oldConfig.getString("multiLoader"));
Config.localVersion = oldConfig.getString("localVersion");
Config.modpackId = oldConfig.getString("versionAPI");
Config.multiVersion = Boolean.parseBoolean(oldConfig.getString("multiVersion"));
Config.useModpackName = Boolean.parseBoolean(oldConfig.getString("useModpackName"));
Config.modpackName = oldConfig.getString("modpackName");
Config.useCustomMessage = Boolean.parseBoolean(oldConfig.getString("useCustomMessage"));
Config.customMessage = oldConfig.getString("customMessage");
Config.linkChangelog = Boolean.parseBoolean(oldConfig.getString("linkChangelog"));
Config.ignoreColor = Config.colorEnum.valueOf(oldConfig.getString("ignoreColor"));
Config.messageColor = Config.colorEnum.valueOf(oldConfig.getString("messageColor"));
Config.changelogColor = Config.colorEnum.valueOf(oldConfig.getString("changelogColor"));
Config.HANDLER.save();
AIUTD.LOG.info("Config migrated, please double check it for accuracy!");
Files.deleteIfExists(Path.of(YACLPlatform.getConfigDir() + "/aiutd.json5"));
AIUTD.LOG.info("Old config has been deleted");
}
} catch (IOException e) {
AIUTD.LOG.error("Failed to migrate config! Please do so manually!", e);
}
try {
if (Files.exists(Path.of(YACLPlatform.getConfigDir() + "/aiutd-enduser.json5"))){
AIUTD.LOG.info("Pre-2.5.0 end user config found. Migrating...!");
String JSONContent = Files.readString(Path.of(YACLPlatform.getConfigDir() + "/aiutd-enduser.json5"));
JSONObject oldUserConfig = JSON.parseObject(JSONContent, JSONReader.Feature.AllowUnQuotedFieldNames);
EndUserConfig.USERCONFIG.load();
EndUserConfig.shouldIgnore = Boolean.parseBoolean(oldUserConfig.getString("shouldIgnore"));
Config.HANDLER.save();
AIUTD.LOG.info("End user config migrated, please double check it for accuracy!");
Files.deleteIfExists(Path.of(YACLPlatform.getConfigDir() + "/aiutd.json5"));
AIUTD.LOG.info("Old end user config has been deleted");
}
} catch (IOException e) {
AIUTD.LOG.error("Failed to migrate end user config! Please do so manually!", e);
}
}
}
FAQ
- Is this faster than using the built-in Gson serializer?
- In a word, yes. In a few more words, based on pure library performance, yes. In practice it's a bit harder to say and will likely depend on the size of the config in question. Will it make a massive difference in anything when used in a single mod? Not noticeably; if you get several using it, you may start to see something a bit more tangible.
- Why make it if it wont improve performance much?
- IDK, becuse I can? Free will and what not.
- WAST has a better score on 3/4 of the tests, why not use it?†
- Becuse I was already familiar with FastJSON and didn't need to learn anything new to make it. If I need (or want) to learn WAST one day maybe I'll make something for it then.
*Until I set up another maven †As of June 28th, 2026
All Versions
+ Add Version| Name | Game version | Platforms | Published | Downloads | Actions |
|---|---|---|---|---|---|
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 2mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 3mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 | ||||
| 4mo ago | 1 |
- optimize serializer - ([0418c75](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0418c759ce80b72769bda306451354f9c5f5dfba)) - VesMaybeVesper
- optimize serializer - ([0418c75](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0418c759ce80b72769bda306451354f9c5f5dfba)) - VesMaybeVesper
- optimize serializer - ([0418c75](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0418c759ce80b72769bda306451354f9c5f5dfba)) - VesMaybeVesper
- optimize serializer - ([0418c75](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0418c759ce80b72769bda306451354f9c5f5dfba)) - VesMaybeVesper
- optimize serializer - ([0418c75](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0418c759ce80b72769bda306451354f9c5f5dfba)) - VesMaybeVesper
- optimize serializer - ([0418c75](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0418c759ce80b72769bda306451354f9c5f5dfba)) - VesMaybeVesper
- optimize serializer - ([0418c75](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0418c759ce80b72769bda306451354f9c5f5dfba)) - VesMaybeVesper
- optimize serializer - ([0418c75](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0418c759ce80b72769bda306451354f9c5f5dfba)) - VesMaybeVesper
- bump gradle - ([0d16580](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0d1658082849e2e56c54c1247854e1c4ac28634c)) - VesMaybeVesper
- update fastjson2 to 2.0.65 - ([bdb8cba](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/bdb8cba733189fe534cfa61fd7cdf1b8c53ee1eb)) - VesMaybeVesper
- bump gradle - ([0d16580](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0d1658082849e2e56c54c1247854e1c4ac28634c)) - VesMaybeVesper
- update fastjson2 to 2.0.65 - ([bdb8cba](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/bdb8cba733189fe534cfa61fd7cdf1b8c53ee1eb)) - VesMaybeVesper
- bump gradle - ([0d16580](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0d1658082849e2e56c54c1247854e1c4ac28634c)) - VesMaybeVesper
- update fastjson2 to 2.0.65 - ([bdb8cba](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/bdb8cba733189fe534cfa61fd7cdf1b8c53ee1eb)) - VesMaybeVesper
- bump gradle - ([0d16580](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0d1658082849e2e56c54c1247854e1c4ac28634c)) - VesMaybeVesper
- update fastjson2 to 2.0.65 - ([bdb8cba](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/bdb8cba733189fe534cfa61fd7cdf1b8c53ee1eb)) - VesMaybeVesper
- bump gradle - ([0d16580](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0d1658082849e2e56c54c1247854e1c4ac28634c)) - VesMaybeVesper
- update fastjson2 to 2.0.65 - ([bdb8cba](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/bdb8cba733189fe534cfa61fd7cdf1b8c53ee1eb)) - VesMaybeVesper
- bump gradle - ([0d16580](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0d1658082849e2e56c54c1247854e1c4ac28634c)) - VesMaybeVesper
- update fastjson2 to 2.0.65 - ([bdb8cba](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/bdb8cba733189fe534cfa61fd7cdf1b8c53ee1eb)) - VesMaybeVesper
- bump gradle - ([0d16580](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0d1658082849e2e56c54c1247854e1c4ac28634c)) - VesMaybeVesper
- update fastjson2 to 2.0.65 - ([bdb8cba](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/bdb8cba733189fe534cfa61fd7cdf1b8c53ee1eb)) - VesMaybeVesper
- bump gradle - ([0d16580](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/0d1658082849e2e56c54c1247854e1c4ac28634c)) - VesMaybeVesper
- update fastjson2 to 2.0.65 - ([bdb8cba](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/bdb8cba733189fe534cfa61fd7cdf1b8c53ee1eb)) - VesMaybeVesper
### Chores
- Update FastJson2 to 2.0.64 - ([31ae447](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/31ae447cca8b96584953fafc2ad932f9ecc901c9)) - VesMaybeVesper
### Fixes
- Change the way FastJson2 is handled as a dependancy - ([259633c](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/259633c7dd8257b326cf56e88537d44cc6dead12)) - VesMaybeVesper
- Fixes an issue where mods using this as a dependency couldn't launch in devenv but could in prod
### Chores
- Update FastJson2 to 2.0.64 - ([31ae447](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/31ae447cca8b96584953fafc2ad932f9ecc901c9)) - VesMaybeVesper
### Fixes
- Change the way FastJson2 is handled as a dependancy - ([259633c](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/259633c7dd8257b326cf56e88537d44cc6dead12)) - VesMaybeVesper
- Fixes an issue where mods using this as a dependency couldn't launch in devenv but could in prod
### Chores
- Update FastJson2 to 2.0.64 - ([31ae447](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/31ae447cca8b96584953fafc2ad932f9ecc901c9)) - VesMaybeVesper
### Fixes
- Change the way FastJson2 is handled as a dependancy - ([259633c](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/259633c7dd8257b326cf56e88537d44cc6dead12)) - VesMaybeVesper
- Fixes an issue where mods using this as a dependency couldn't launch in devenv but could in prod
### Chores
- Update FastJson2 to 2.0.64 - ([31ae447](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/31ae447cca8b96584953fafc2ad932f9ecc901c9)) - VesMaybeVesper
### Fixes
- Change the way FastJson2 is handled as a dependancy - ([259633c](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/259633c7dd8257b326cf56e88537d44cc6dead12)) - VesMaybeVesper
- Fixes an issue where mods using this as a dependency couldn't launch in devenv but could in prod
### Chores
- Update FastJson2 to 2.0.64 - ([31ae447](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/31ae447cca8b96584953fafc2ad932f9ecc901c9)) - VesMaybeVesper
### Fixes
- Change the way FastJson2 is handled as a dependancy - ([259633c](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/259633c7dd8257b326cf56e88537d44cc6dead12)) - VesMaybeVesper
- Fixes an issue where mods using this as a dependency couldn't launch in devenv but could in prod
### Chores
- Update FastJson2 to 2.0.64 - ([31ae447](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/31ae447cca8b96584953fafc2ad932f9ecc901c9)) - VesMaybeVesper
### Fixes
- Change the way FastJson2 is handled as a dependancy - ([259633c](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/259633c7dd8257b326cf56e88537d44cc6dead12)) - VesMaybeVesper
- Fixes an issue where mods using this as a dependency couldn't launch in devenv but could in prod
### Chores
- Update FastJson2 to 2.0.64 - ([31ae447](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/31ae447cca8b96584953fafc2ad932f9ecc901c9)) - VesMaybeVesper
### Fixes
- Change the way FastJson2 is handled as a dependancy - ([259633c](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/259633c7dd8257b326cf56e88537d44cc6dead12)) - VesMaybeVesper
- Fixes an issue where mods using this as a dependency couldn't launch in devenv but could in prod
### Chores
- Update FastJson2 to 2.0.64 - ([31ae447](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/31ae447cca8b96584953fafc2ad932f9ecc901c9)) - VesMaybeVesper
### Fixes
- Change the way FastJson2 is handled as a dependancy - ([259633c](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/259633c7dd8257b326cf56e88537d44cc6dead12)) - VesMaybeVesper
- Fixes an issue where mods using this as a dependency couldn't launch in devenv but could in prod
- Strict versioning no longer prevents minecraft from launching [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([250e9c9](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/250e9c9f292bc952bb21814761a0e264de49634d)) - VesMaybeVesper
- Mod actually no longer looks for the wrong yacl modid [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([c3d2716](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/c3d2716c7d6bb938200923d1014bd14241ca38ab)) - VesMaybeVesper
- Strict versioning no longer prevents minecraft from launching [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([250e9c9](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/250e9c9f292bc952bb21814761a0e264de49634d)) - VesMaybeVesper
- Mod actually no longer looks for the wrong yacl modid [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([c3d2716](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/c3d2716c7d6bb938200923d1014bd14241ca38ab)) - VesMaybeVesper
- Strict versioning no longer prevents minecraft from launching [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([250e9c9](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/250e9c9f292bc952bb21814761a0e264de49634d)) - VesMaybeVesper
- Mod actually no longer looks for the wrong yacl modid [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([c3d2716](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/c3d2716c7d6bb938200923d1014bd14241ca38ab)) - VesMaybeVesper
- Strict versioning no longer prevents minecraft from launching [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([250e9c9](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/250e9c9f292bc952bb21814761a0e264de49634d)) - VesMaybeVesper
- Mod actually no longer looks for the wrong yacl modid [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([c3d2716](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/c3d2716c7d6bb938200923d1014bd14241ca38ab)) - VesMaybeVesper
- Strict versioning no longer prevents minecraft from launching [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([250e9c9](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/250e9c9f292bc952bb21814761a0e264de49634d)) - VesMaybeVesper
- Mod actually no longer looks for the wrong yacl modid [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([c3d2716](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/c3d2716c7d6bb938200923d1014bd14241ca38ab)) - VesMaybeVesper
- Strict versioning no longer prevents minecraft from launching [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([250e9c9](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/250e9c9f292bc952bb21814761a0e264de49634d)) - VesMaybeVesper
- Mod actually no longer looks for the wrong yacl modid [#2](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/issues/2) - ([c3d2716](https://github.com/vesmaybevesper/FASTJSON2-Serializer-for-YACL/commit/c3d2716c7d6bb938200923d1014bd14241ca38ab)) - VesMaybeVesper