
This serializer is enabled by ContextualSerialization. This class provides support for retrieving a serializer in runtime, instead of using the one precompiled by the serialization plugin. The serialized form, described by the serial descriptor passed to Encoder.beginStructure. interface CompositeDecoderĬompositeEncoder is a part of encoding process that is bound to a particular structured part of The serialized form, described by the serial descriptor passed to Decoder.beginStructure. Via dump and load methods interface BinaryFormat : SerialFormatĬompositeDecoder is a part of decoding process that is bound to a particular structured part of SerialFormat that allows conversion to and from ByteArray FieldKeyNumberValue, but had class .serialization - kotlinx-serialization kotlinx-serialization / rialization Package rializationīasic core concepts and annotations that set up serialization process. JsonDecodingException: Expected class (Kotlin reflection is not available) as the serialized body of. FieldKeyNumberValue, but had class (Kotlin reflection is not available) Expected class (Kotlin reflection is not available) as the serialized body of. Due to the way I structured the sealed classes, it appears that the serialization frameworks expects the value to be an object. I think I do understand why the error is thrown. JsonContentPolymorphicSerializer(FieldKeyValue::class) ĪssertEquals(codeFromString("42"), FieldKeyNumberValue(42))ĪssertEquals(codeFromString("\"42\""), FieldKeyStringValue("42")) Sealed class FieldKeyNumberValue(val value: Int) : FieldKeyStringValue(val value: String) : FieldKeyValue() These are my classes: = FieldKeyValueDeserializer::class) I tried to take advantage of JsonContentPolymorphicSerializer but the serializer assumes that the JSON is defined inside of an object whereas I want to deserialize literals. Some of the values in there can either be a number or a string ( the value field).
