Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse raw JsonObject with kotlinx serialization #22

Closed
omkar-tenkale opened this issue Nov 29, 2022 · 1 comment
Closed

Parse raw JsonObject with kotlinx serialization #22

omkar-tenkale opened this issue Nov 29, 2022 · 1 comment

Comments

@omkar-tenkale
Copy link

I'm unable to parse raw json using KMongo with kotlinx serialization

@Serializable
data classPersonInInDB(
    var _id: String? = null,
    @Contextual val updatedAt: Date,
    var value: kotlinx.serialization.json.JsonObject,
)
java.lang.IllegalStateException: This serializer can be used only with Json format.Expected Decoder to be JsonDecoder, got class com.github.jershell.kbson.BsonFlexibleDecoder
	at kotlinx.serialization.json.JsonElementSerializersKt.asJsonDecoder(JsonElementSerializers.kt:201)
	at kotlinx.serialization.json.JsonElementSerializersKt.verify(JsonElementSerializers.kt:197)
	at kotlinx.serialization.json.JsonElementSerializersKt.access$verify(JsonElementSerializers.kt:1)
	at kotlinx.serialization.json.JsonObjectSerializer.deserialize(JsonElementSerializers.kt:161)
	at kotlinx.serialization.json.JsonObjectSerializer.deserialize(JsonElementSerializers.kt:144)
	at kotlinx.serialization.encoding.Decoder$DefaultImpls.decodeSerializableValue(Decoding.kt:257)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:16)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)

Is it even possible?

@omkar-tenkale
Copy link
Author

Litote/kmongo#387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant