OSS TanbouSign in with GitHub

Generate multi-format encoding and decoding code from Kotlin types

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
5,946
Primary language
Kotlin
License
Apache-2.0
Repository last updated
Oct 1, 2026
On this page

Overview

kotlinx.serialization is the official library for converting Kotlin types to data formats such as JSON and decoding them back. A compiler plugin generates handling code for classes annotated with @Serializable, while runtime libraries implement individual formats. The same model definitions can be used in multiplatform code spanning JVM, JS, and Native.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Use type definitions across JSON, Protocol Buffers, CBOR, and other formats

The plugin generates reflectionless conversion code for @Serializable Kotlin classes and standard collections. Official format libraries cover JSON, Protocol Buffers, CBOR, HOCON, and Properties, with typed round trips through APIs such as Json.encodeToString and Json.decodeFromString.

Sources: [1]

Best fit

Fits shared models used across runtimes and wire formats

It suits Kotlin Multiplatform applications sharing common models across JVM, JS, and Native, as well as projects that want typed API payloads, configuration, or stored data. It is especially useful when JSON is the starting point but the same model definitions may also need Protocol Buffers or CBOR.

Sources: [1]

Before adoption

Manage compiler-plugin and runtime-library versions separately

The serialization plugin follows the Kotlin compiler version, while runtime libraries have an independent version line. The stable 1.11.0 README pairs the runtime with Kotlin 2.3.20. Android shrinker rules are bundled for ordinary serializable classes, but classes with named companion objects need additional rules. Format compatibility and defaults should be reviewed in the changelog during upgrades. The project is Apache-2.0 licensed.

Sources: [1][2][3][4]

Official sources

  1. [1]Kotlin/kotlinx.serialization — README 1.11.0(2026-10-04)
  2. [2]Kotlin/kotlinx.serialization — CHANGELOG 1.11.0(2026-10-04)
  3. [3]kotlinx.serialization 1.11.0 release(2026-10-04)
  4. [4]Kotlin/kotlinx.serialization — LICENSE(2026-10-04)
Supplemental curator note

Its practical advantage is keeping Kotlin types at the center instead of maintaining hand-written conversion code for every format. Plan upgrades carefully because the compiler plugin and runtime libraries follow different version lines.

Try it in 3 steps

  1. 1

    Enable the compiler plugin

    In an existing Kotlin/JVM Gradle project, use Kotlin 2.3.20 for both Kotlin and the serialization compiler plugin.

    plugins { kotlin("jvm") version "2.3.20" kotlin("plugin.serialization") version "2.3.20" }
  2. 2

    Add the JSON library

    Add it to the Gradle dependencies block and use mavenCentral().

    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")
  3. 3

    Encode and decode a typed value

    Import kotlinx.serialization.* and kotlinx.serialization.json.*, declare Project at file scope, and run the conversion inside main.

    @Serializable data class Project(val name: String, val language: String) fun main() { val text = Json.encodeToString(Project("demo", "Kotlin")) println(Json.decodeFromString<Project>(text)) }
Check the official README

Growth

Growth trends · Last 30 days

5,946 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
2
Open PRs
38

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • kotlin
  • serialization
  • json
  • cbor
  • protobuf
Stars
5,946
Forks
685
Watchers
100
Open issues
268
Contributors
198
Owner type
Organization
Primary language
Kotlin
License
Apache-2.0
Repository last updated
Oct 1, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?