Nikola Milovic
01/11/2022, 1:19 PMimport kotlinx.serialization.Serializable
@Serializable
data class MessageModel (val senderId : String, val channelId : String, val id : String, val contents : String, val date : Long)
And when I do this inside my (this is a multiplatform project) web app
console.log(message.date::class.simpleName )
The result is Double
!! What is happening here? It's causing me runtime errors, as I need a long. This MessageModel I receive from my backend and the value of the date is epoch milis, and the value is 1641905913211
this is interpreted as double. But if I don't use the value of message.date
and instead just directly input 1641905913211
it works, meaning the value isn't the issue, but for some reason when serializing it becomes a double? Not sure where to ask this, is this Multiplatform issue, Kotlin general issue?
const val kotlin = "1.6.10"
const val kotlinxSerialization = "1.3.2"
ephemient
01/11/2022, 2:40 PMNikola Milovic
01/11/2022, 2:45 PMephemient
01/11/2022, 2:49 PMNikola Milovic
01/11/2022, 2:50 PMephemient
01/11/2022, 2:51 PM