![]() ![]() ![]() To make our data class serializable, all you need to do is add the annotation above the class declaration. Each user object has a range of attributes it can have (just to name a few): Enter your class name and then append the data keyword before it.įor the sake of this article, lets say we are working with an API that returns a list of users. If you are using Android Studio, just right click inside your project’s module and choose New Kotlin file. In order to have something we can serialize and later de-serialize, we need to work with data classes. ⚠️ If you encounter any errors, make sure the versions you put are correct HOCON (Human Optimized Config Object Notation).CBOR (Concise Binary Object Representation). ![]() Note that we are using the json format of the library, but there are other formats that are supported as well: Sync your project and you should be good to go. Head into your project level adle file, and inside the buildscript object, in the dependencies section, put in classpath for the kotlin-serialization library with the version you need. Heading to the releases page of kotlin-serialization library, you see that the version of the kotlin-serialization library that you need to use is 1.3.2.Looking over the compatibility map, you see it is compatible with Kotlin version 1.6.10. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |