
Implementation ":kotlinx-serialization-runtime:0.20.0"Ĭlasspath ":kotlin-serialization:$kotlin_version"Ĭheck out the official doc for the latest runtime version.

You would need to modify your adle a bit, but after that is super easy. Kotlin's own way is a compiler plugin with a runtime dependency. And Kotlin, since version 1.3, provides its own way way for serializing to and from JSON (and other formats, like protobuf - maybe in another post). There are other modern JSON libraries out there (e.g.

But lately, especially with Kotlin's null-aware type system, the library fell out of grace. In the past, this used to be the Gson library. In Android (and in the Java world in general) this was traditionally "outsourced" to a dedicated library. And to make everything more complex, the order of operations matter the contents of the class must be read in the same order they were written.So you want to quickly convert your Data classes to JSON and vice-versa. This Parcelable.Creator interface has two functions that need to be implemented: createFromParcel and newArray. It requires implementing the interface functions describeContents and writeToParcel, as well as, creating a static field called CREATOR that implements the Parcelable.Creator interface. The process of implementing the Parcelable interface has always been tedious, verbose, and error prone. So implementing the Parcelable interface allows an object to be passed between the different Android components. An Android Parcel is a container of values that can be sent between different Android components, such as Activities and Fragments.


Android ParcelableĪndroid's Parcelable is an object whose values can be written and read from a Parcel. Introducing the new parcelable library which enables using rialization to serialize data into Android Parcels to be passed between different Android Components.
