It seems clear today that kotlinx.serialization is the chosen one.
Among all the many libraries to parse JSON with Kotlin in Android. Say… Klaxon, Jackson, Gson, Json2kotlin, etc. kotlinx.serialization is presently attested champion.
There’s no doubt kotlinx.serialization is the future as it is part of Kotlin libraries now. Although it is still at the time of writing this post in incubator stage.
Kotlin serialization consists of a compiler plugin, that generates visitor code for serializable classes, runtime library with core serialization API and JSON format, and support libraries with ProtoBuf, CBOR and properties formats.
- Supports Kotlin classes marked as
@Serializableand standard collections.
- Provides JSON, CBOR, and Protobuf formats.
- Complete multiplatform support: JVM, JS and Native.
Starting from Kotlin 1.3-RC2, serialization plugin is shipped with the rest of Kotlin compiler distribution, and the IDEA plugin is bundled into the Kotlin plugin. Easy peasy!
It’s also very stress-free to integrate and use…
Therefore, if you are looking for a JSON parser for your REST-needed-App, don’t think it twice, get kotlinx.serialization running and start parsing JSONs without too much hassle.