Skip to content

deserialization: IllegalStateException when null occurs in JSON input in place of an expected non-null object #816

@AcidApeStudios

Description

@AcidApeStudios

SerializationException should be thrown instead.

Example: try to parse this JSON:

{"foo":null}

for deserializing this class:

class MyClass(val foo: SomeObject)

This exception is thrown:

    java.lang.IllegalStateException: Expected class kotlinx.serialization.json.JsonObject but found class kotlinx.serialization.json.JsonNull
        at kotlinx.serialization.json.internal.AbstractJsonTreeInput.beginStructure(TreeJsonInput.kt:224)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions