https://kotlinlang.org logo
#android
Title
# android
j

Jonny

08/17/2019, 5:02 PM
I'm not sure why I'm unable to parse a Job object with Klaxon, but it's possible when i parse several jobs with Klaxon().parseArray. Any ideas?
Copy code
class Job {
    var id: Int = 0
    var accountId: String = ""
    var lat: Double = 0.0
    var lon: Double = 0.0
    var price: Int = 0
    var description: String? = null
    var status: String? = null
}

val job = Klaxon().parse<Job>(response.toString())!!
and this is how the response.toString() looks like:
{"Id":13,"AccountId":"6ab14051-7753-4aa2-99e0-54212d4c7666","Price":490,"Lat":57.78421774386467,"Lon":14.286020882427692,"Description":"Bbjjj","Status":null}