Ian
09/26/2020, 6:12 AMfun main() {
@Serializable data class Foo(val nn : Int?)
val s = ProtoBuf.encodeToByteArray(Foo.serializer(), Foo(null))
}
But get:
Exception in thread "main" kotlinx.serialization.SerializationException:
'null' is not supported in ProtoBuf
I've also tried using:
val s = ProtoBuf { encodeDefaults = false }.encodeToByteArray(Foo.serializer(), Foo(null))
But this doesn't help.
Any pointers appreciated.Vampire
09/26/2020, 10:56 AMnull
as default value (and if necessary define not to encode default values) it might work as then there is no need to encode the unsupported null
Ian
09/26/2020, 2:20 PM