Answer the question
In order to leave comments, you need to log in
Kotlin how to access the properties of a json object through a dot?
Kotlin how to access the properties of a json object through a dot? The object is returned to me by node.js api. For http requests I use the Fuel library. I am writing an android client. Thanks
Answer the question
In order to leave comments, you need to log in
import com.fasterxml.jackson.module.kotlin.*
data class User(val id: Int, val name: String)
fun main(args: Array<String>) {
val mapper = jacksonObjectMapper()
val json = """{"id": 10, "name": "Kirill"}"""
val user = mapper.readValue<User>(json)
println(user.name)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question