Kotlin - How to convert Object to/from JSON by Gson with Kotlin language
https://grokonez.com/kotlin/kotlin-convert-object-tofrom-json-gson-kotlin-language
This tutorial shows you how to use Gson to convert Kotlin object to/from JSON.
Person(name:String,age:Int,messages:List)
Kotlin Object/List/Map
- Convert Person
Object/List/Map to JSON string.
<dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>1.1.2</version> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
More at:
https://grokonez.com/kotlin/kotlin-convert-object-tofrom-json-gson-kotlin-language
#kotlin #object #json #gson