Michal Janos
03/15/2023, 11:18 PM@Test
fun serializeTest() {
@Serializable
data class Data(val a: Int, val b: String)
val obj: Data = Json.decodeFromString("""{"a":42, "b": "str"}""")
assertEquals(42, obj.a)
}
error:
SerializationException: Serializer for class 'Data' is not found.
Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.
On Kotlin/JS explicitly declared serializer should be used for interfaces and enums without @Serializable annotation
SerializationException: Serializer for class 'Data' is not found.
Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.
it can be fixed with
Json.decodeFromString(Data.serializer(), """{"a":42, "b": "str"}""")
but in our code we have used serializer for parse json to list
Kotlin 1.8.10
kotlin("plugin.serialization") version "1.8.10"
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
Adam S
03/16/2023, 11:04 AMMichal Janos
03/16/2023, 11:14 AMgradle-plugin
and maybe kotlin.js.compiler=ir
helps too.
So problem with serializer looks like fixed, but actualy I need to investigate some failed tests (16 of 23 284)