SalomonBrys / Kotson

Kotlin bindings for JSON manipulation via Gson
MIT License
709 stars 37 forks source link

Simple samples of using Kotson are necessary #41

Open kubanychlocal opened 6 years ago

kubanychlocal commented 6 years ago

for example, this does not work

`import com.github.salomonbrys.kotson. import com.google.gson.

fun main (args: Array ) { val obj:JsonObject = jsonObject( "name" to "kotson", "files" to 4 ) println(" ${obj}") class Person(public val obj: JsonObject) { val name: String by obj.byString("name") val files: Int by obj.byInt("files")
} val person=Gson().fromJson(obj,Person ::class.java) }`