Hello! I'm trying to serialize both LocalDateTime ...
# serialization
m
Hello! I'm trying to serialize both LocalDateTime and EntityID<Int> types. When I use the @Serializable(with=) annotation, it works properly but when I use @Contextual annotation it says "no serializer found for class LocalDateTime". I have a function that configures the serialization context and returns the json object, which I use to serialize the UserSerializer data class which I want but it still doesn't work. Here's the function:
Copy code
fun configureSerializationContext(): Json {
    val module = SerializersModule {
        contextual(EntityIDSerializer)
        contextual(LocalDateTimeSerializer)
//        contextual(EntityID::class) { args -> EntityIDSerializer(args[0]) }
    }

    return Json { serializersModule = module }
}
Then in the route where the json object is used, I'm doing something like json.encodeToString(UserSerializer.serializer(), UserSerializer(THE NECESSARY PROPERTIES)) My concern is, isn't the @Contextual annotation like a substitute for the @Serializable(with=) annotation?