Hey! I'm trying to get the `KSerializer` for a `Li...
# serialization
t
Hey! I'm trying to get the
KSerializer
for a
List
from a Java Class but it seems to be retrieving the underlying implementation of
ArrayList
Here's basically how I get the
KSerializer
Copy code
val serializer = json.serializersModule.serializerOrNull(serializerClazz)
  ?: error("No serializer found for type: ${clazz.simpleName}")
Exception in thread "main" kotlinx.serialization.SerializationException: Serializer for subclass 'ArrayList' is not found in the polymorphic scope of 'List'.
Check if class with serial name 'ArrayList' exists and serializer is registered in a corresponding SerializersModule.
To be registered automatically, class 'ArrayList' has to be '@Serializable', and the base class 'List' has to be sealed and '@Serializable'.
I've been struggling on this for a few hours now so I'm unsure of how to go further, help would be greatly appreciated, thank you. Here's an issue I found but there's no posted solution 🥹 https://youtrack.jetbrains.com/issue/KTOR-5898/serializerForTypeInfo-throws-an-error-abo[…]rphic-serialization-instead-of-a-serializer-not-found-one