Gibt es einen Weg und/oder eine Bibliothek, um automatisch eine Kotlin Data Klasse von Json zu erstellen, so wie es in Scala Json.Spray funktioniert?Json nach Kotlin Datenklasse
Etwas wie folgt aus:
data class User(id: Int, name: String)
class DataClassFactory(val json: String) {
fun getUser(): User {
//some reflection
return User(10, "Kirill")
}
}
fun main(args: Array<String>): Unit {
val json = "{id: 10, name: Kirill}"
val usr = DataClassFactory(json).getUser()
println(usr)
}
Vielleicht finden Sie es interessant: http://youtrack.jetbrains.com/issue/KT-5672, [Kotlin-Modul für Jackson, unterstützt unveränderliche Objekte] (https: //www.linkedin.com/groups/Kotlin-module-Jackson-supporting-immutable-7417237.S.5910775828316172289?trk=groups_most_popular-0-b-ttl&goback=%2Enpv_158961627_*1_*1_*1_*1_*1_*1_ 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_ * 1_nav * 4antwort * 4tab * 4profile_ * 1% 2Egmp_7417237) – bashor
Kannst du mir einen Link zu JAR-Datei ohne Maven schicken? – OZKA
http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22jackson-module-kotlin%22 – bashor