Hey ya'll, I am trying to implement serialization ...
# serialization
h
Hey ya'll, I am trying to implement serialization of a simple data class using the MongoDb kotlin driver, with the
bson-kotlinx
build in serializers, but keep running into issues. The last issue that I couldn't overcome before I resorted to trying other methods was that a
StreamingJsonEncoder
was being chosen to encode the class
ObjectId
identifier, causing the
ObjectIdSerializer
to fail. Has anyone successfully implemented this? Is my issue that I am using the same data class for both the request and reponse?
Here is my data class
The error that i ultimately get is
kotlinx.serialization.SerializationException: ObjectId is not supported by class kotlinx.serialization.json.internal.StreamingJsonEncoder
when trying to fetch a User. I have a feeling this has something to do with Ktor, as insertion seems to work fine... But I'm not sure how to proceed