FASTJSON2 Serializer for YACL

FASTJSON2 Serializer for YACL

A config serializer for YetAnotherConfigLib using FASTJSON2

von
5.4K Downloads
fabricforgeneoforgequiltlibrary
Server mit dieser Mod mieten

Über diese Mod

A serializer for YetAnotherConfigLib made using FASTJSON2.

Modrinth Downloads CurseForge Downloads

FASTJSON2 Serializer for YACL (fastjson4yacl) is a library mod to allow other mods to use FastJSON2 for config (de)serialization. On its own it does nothing, you need other mods to utilize fastjson4yacl.

FASTJSON2 Serializer for YACL is also available in Evening Star Lib

Join the Fluxer server for community & mod support

Useage


Add as a dependancy as outlined on the version page*
// >= 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

Verfügbare Versionen

FASTJSON2 Serializer for YACL 1.0.6 Fabric 26.1release
MC 26.1, 26.1.1, 26.1.2, 26.2, 26.3-snapshot-9fabric
13. August 2026
FASTJSON2 Serializer for YACL 1.0.6 Neoforge 26.1release
MC 26.1, 26.1.1, 26.1.2, 26.2neoforge
13. August 2026
FASTJSON2 Serializer for YACL 1.0.6 Fabric 1.21.5release
MC 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11fabric
13. August 2026
FASTJSON2 Serializer for YACL 1.0.6 Neoforge 1.21.5release
MC 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11neoforge
13. August 2026
FASTJSON2 Serializer for YACL 1.0.6 Fabric 1.21.1release
MC 1.21.1, 1.21.2, 1.21.3, 1.21.4fabric
13. August 2026

FASTJSON2 Serializer for YACL auf dem Server installieren

1

Server bestellen

Bestelle einen Minecraft Java Server mit mindestens 3 GB RAM (4 GB empfohlen).

2

fabric Loader setzen

Wähle im Panel unter "Egg" den fabric-Loader und die passende Minecraft-Version (26.3-snapshot-9).

3

Mod installieren

Öffne den Mod-Browser im Dashboard und suche nach "FASTJSON2 Serializer for YACL". Klicke "Installieren" – fertig! Alternativ: Lade die .jar via SFTP in den /mods Ordner.

Kompatibilität

Mod-Loader

fabricforgeneoforgequilt

Minecraft-Versionen

26.3-snapshot-9, 26.2, 26.1.2 (+14 weitere)

Server-seitig

~ Optional

Empfohlener RAM

4 GB(min. 3 GB)

Häufige Fragen

FASTJSON2 Serializer for YACL Server crasht beim Start – was tun?

Häufigste Ursache: falsche fabric-Version oder zu wenig RAM. Prüfe im Server-Log (latest.log), ob ein "OutOfMemoryError" oder "Mixin"-Fehler auftritt. Bei Mado Hosting: Stelle sicher, dass mindestens 3 GB RAM zugewiesen sind und der Loader zur Mod-Version passt (26.3-snapshot-9). Über das Panel kannst du den Loader mit einem Klick wechseln.

Ist FASTJSON2 Serializer for YACL mit fabric und forge und neoforge und quilt kompatibel?

FASTJSON2 Serializer for YACL unterstützt offiziell fabric, forge, neoforge, quilt für Minecraft 26.3-snapshot-9, 26.2, 26.1.2. Achtung: Forge- und Fabric-Mods sind NICHT untereinander kompatibel – wähle einen Loader und bleibe dabei. Im Mado Dashboard werden inkompatible Loader-Kombinationen automatisch erkannt.

Server laggt mit FASTJSON2 Serializer for YACL – wie optimiere ich die Performance?

Empfohlener RAM: 4 GB (+1 GB pro 8 Spieler). Prüfe mit /spark profiler, ob FASTJSON2 Serializer for YACL den meisten Tick-Time verbraucht. Häufige Fixes: Server-View-Distance auf 8-10 reduzieren, bei Forge "performant" oder "starlight" als Zusatz-Mod installieren. Bei Mado Hosting läuft dein Server auf NVMe-SSDs mit dedizierten CPU-Kernen für minimale Latenz.

Modded Server mieten

Installiere FASTJSON2 Serializer for YACL mit nur einem Klick auf deinem Server.

Empfohlener RAM
4 GBab €5.2/Monat
Min. 3 GB | +1 GB pro 8 Spieler
Jetzt Server erstellen
1-Klick Mod Installation
NVMe SSD Speicher
DDoS-Schutz inklusive

Details

Lizenz
MIT License
Server-seitig
Optional

Unterstützte Versionen

26.3-snapshot-926.226.1.226.1.126.11.21.111.21.101.21.91.21.81.21.7+7 mehr