You could use js JSON.parse() and model your classes as external for now. That way you can live without kotlinx.serializatiom
s
spierce7
05/09/2021, 8:35 PM
I’m kind of surprised the issue with compose and kotlinx serialization still hasn’t been fixed.
m
MrPowerGamerBR
05/09/2021, 8:50 PM
@Big Chungus
JSON.parse()
is utterly broken in Kotlin/JS.
Yes, it works, but that doesn't mean it is a nice developer experience because you have a multitude of issues with it, off the top of my head: You can't serialize Longs, you can't use any Kotlin functions (if you are trying to deserialize a List), so on and so forth. Kotlinx Serialization is a god send for the JS target so it is a bummer that it doesn't work yet.
What seems to work fine (from a tip by @SrSouza) is creating a separate module with the Serialization plugin, and making the Compose project depend on that module. But then again, I haven't tested it too much yet but it seems to work for deserialization.