JSON serialization and deserialization are very important for every Android application and are frequently used. For that purpose, we will be using the Gson library developed by Google. Also, we will use Kotson and Kotlin bindings for Gson. So, let's start!
First of all, we need to provide dependencies for our build.gradle configuration as follows:
apply plugin: "com.android.application" apply plugin: "kotlin-android" apply plugin: "kotlin-android-extensions" ... dependencies { ... compile 'com.google.code.gson:gson:2.8.0' compile 'com.github.salomonbrys.kotson:kotson:2.3.0' ... }
We will update our code to use Gson with Kotson bindings for location serialization/deserialization in database management. ...