<@U6647LJ30> is there any updated doc on writing c...
# serialization
t
@sandwwraith is there any updated doc on writing custom serializer? This one uses deprecated code and doesn't compile: https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/custom_serializers.md#customizing
this note (https://github.com/Kotlin/kotlinx.serialization/blob/4ae3d34a05616d6542eca2b88afc7e30f9a0d9b6/docs/eap13.md#migration-guide) touches migrations a bit, but KSerialClassDesc/SerialDescriptor is still not explained
s
SerialDescriptor is briefly explained in KEEP: https://github.com/Kotlin/KEEP/blob/serialization/proposals/extensions/serialization.md#descriptor-of-a-serializable-entity . But indeed, it needs more documentation. Core problem with example that KOutput was split into two interfaces: one which allows writing primitive values, and one which allows write structured data. So, here example assumes that Data would be written as a single String, so it is sufficient to call
Encoder.encodeString
. You can use also
object StringDescriptor
as a descriptor
t
Yes, actually I'm struggling with polymorphic object (not primitive) deserializer - is there any sample for this?
Copy code
[
            {
              "type": "string",
              "string": "Hello!"
            },
            {
              "type": "datetime",
              "datetime": "2018-10-05T14:36:48.997000+00:00"
            }

]
t
wow great links 👍
definitely should be in docs/samples