Trying to get kotlinx.serialization working on jvm with ktor client (cio) but I keep getting a very unhelpful error
b
bdawg.io
12/10/2018, 5:46 AM
You have to read down for other exceptions that caused the failure
Can't locate argument-less serializer for class io.codehop.friday.RTM. For generic classes, such as lists, please provide serializer explicitly
bdawg.io
12/10/2018, 5:47 AM
Ktor does a pretty good job of describing what caused an issue or linking to another exception that caused it
j
jkbbwr
12/10/2018, 5:48 AM
That doesn't help me figure out what I need to do to fix it.
jkbbwr
12/10/2018, 5:48 AM
Copy code
@Serializable
data class RTM(
@Optional
@SerialName("ok")
val ok: Boolean = false,
@Optional
@SerialName("self")
val self: Self = Self(),
@Optional
@SerialName("team")
val team: Team = Team(),
@Optional
@SerialName("url")
val url: String = ""
)
@Serializable
data class Self(
@Optional
@SerialName("id")
val id: String = "",
@Optional
@SerialName("name")
val name: String = ""
)
@Serializable
data class Team(
@Optional
@SerialName("domain")
val domain: String = "",
@Optional
@SerialName("id")
val id: String = "",
@Optional
@SerialName("name")
val name: String = ""
)
jkbbwr
12/10/2018, 5:48 AM
The class is defined correctly or so I thought
jkbbwr
12/10/2018, 5:49 AM
Decoding it to a string works just fine, but when going to an object it freaks.
jkbbwr
12/10/2018, 5:50 AM
I swear I have had this working but a few days ago