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)
}`
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) }`