kotlinx-serialization class marked @Serializable does not have the .serializer() extension function
In addition to the kotlinx-serialization-runtime
dependency you also need to add the plugin
plugins {
kotlin("multiplatform") // or kotlin("jvm") or any other kotlin plugin
kotlin("plugin.serialization") version "1.4.10"
}
with the same version as Kotlin itself.