Having a very strange serialization issue with Kot...
# serialization
r
Having a very strange serialization issue with Kotlin/Native on my KMP project. I have a data class that is failing kotlinx json serialization, but only on Kotlin/Native for iOS. Please take a look at the stack trace and code in the thread. Any hints/tips very welcome! cc @adriankhor99
iOS stacktrace
The class it's complaining about
Copy code
@Serializable
data class DeleteTrackingRequestBody(
    @SerialName("bowel_movement") val bowelMovement: List<String>? = null,
    val exercise: List<String>? = null,
    val nutrition: List<String>? = null,
    val sleep: List<String>? = null,
    val stress: List<String>? = null,
    val water: List<String>? = null
)
p
@Ryan Simon This looks like a problem in the invocation of the serialization (i.o.w. you are not using the correct serializer). In this context note (per the error message) that for native you have to explicitly create a polymorhpic serializer for interfaces (it works automatically for the other platforms).
r
Yeah, seems that way but the class above has no interfaces and the properties of the class are all supported by the serialization library out of the box This is what has me perplexed