Kotlinx.serialization is a multiplatform serialization library for Kotlin that generates visitor code at compile time rather than using reflection.
The library solves the problem of serializing and deserializing Kotlin objects across multiple platforms and formats without runtime reflection overhead. It uses a compiler plugin to generate boilerplate code for classes marked with the @Serializable annotation, then provides format-specific encoders and decoders at runtime. This approach eliminates reflection costs and enables dead code elimination, making it suitable for performance-sensitive and resource-constrained environments. The tool supports JSON, Protobuf, CBOR, HOCON, and Properties formats, with complete multiplatform coverage across JVM, JavaScript, and Native targets.
Developers should choose this library if they need efficient serialization in Kotlin multiplatform projects or want to avoid reflection-based serialization overhead. It works well for applications targeting multiple platforms simultaneously, particularly those running on Native or embedded systems where reflection is costly. The library is straightforward to adopt, requiring only a compiler plugin setup and a runtime dependency, with clear documentation and examples provided.
The project maintains an active user base, with nearly all open issues coming from external adopters rather than the core team. Maintainers respond to new issues and pull requests within a day. Work in the issue tracker centers on feature requests, bug reports, and user questions.