Back to Kotlinx Serialization

Kotlin Serialization Guide

docs/serialization-guide.md

1.11.016.9 KB
Original Source

Kotlin Serialization Guide

Kotlin Serialization is a cross-platform and multi-format framework for data serialization—converting trees of objects to strings, byte arrays, or other serial representations and back. Kotlin Serialization fully supports and enforces the Kotlin type system, making sure only valid objects can be deserialized.

Kotlin Serialization is not just a library. It is a compiler plugin that is bundled with the Kotlin compiler distribution itself. Build configuration is explained in README.md. Once the project is set up, we can start serializing some classes.

Table of contents

Chapter 1. Basic Serialization (start reading here)

<!--- TOC_REF basic-serialization.md --> <!--- END -->

Chapter 2. Builtin Classes

<!--- TOC_REF builtin-classes.md --> <!--- END -->

Chapter 3. Serializers

<!--- TOC_REF serializers.md --> <!--- END -->

Chapter 4. Polymorphism

<!--- TOC_REF polymorphism.md --> <!--- END -->

Chapter 5. JSON Features

<!--- TOC_REF json.md --> <!--- END -->

Chapter 6. Alternative and custom formats (experimental)

<!--- TOC_REF formats.md --> <!--- END -->

Appendix A. Serialization and value classes (IR-only)

<!--- TOC_REF value-classes.md --> <!--- END -->