-
Type: Improvement
-
Resolution: Done
-
Priority: Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: Local
I'd like to store an array of primitives in my Realm object, so I am declaring it like:
@Serializable class Some: RealmObject { @PrimaryKey var id: String = uuid4().toString() private var list: RealmList<Int> = realmListOf() }
When trying to decode it from the server response I get Expected class kotlinx.serialization.json.JsonObject as the serialized body of kotlinx.serialization.Polymorphic<RealmList>, but had class kotlinx.serialization.json.JsonArray, which is gone in case I mark this list property as @Transient.
I am using Ktor with Json serializer:
val httpClient = HttpClient { expectSuccess = true install(ContentNegotiation) { json(Json { ignoreUnknownKeys = true encodeDefaults = true prettyPrint = true }) } install(HttpTimeout) { requestTimeoutMillis = 15000 } }
Am I missing something? Or RealmList needs a custom serializer to be specified for the class which is using it?