FASTJSON2 Serializer for YACL

A config serializer for YetAnotherConfigLib using FASTJSON2

A serializer for YetAnotherConfigLib made using FASTJSON2.

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.

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 am 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

 

The FASTJSON2 Serializer for YACL Team

profile avatar
  • 3
    Followers
  • 12
    Projects
  • 939.6K
    Downloads

the weather audio girl, i also do some other things lol. chronically sleepy, maker of things, owner of cats

Donate

More from VesMaybeVesperView all