I often have to deserialize objects with fields th...
# serialization
k
I often have to deserialize objects with fields that are possibly null, for example lots of them are
Boolean?
, and if the field is null, that's equivalent to it being
false
. Is there a way to get rid of nulls, and encode them as the field being false?
j
val property: Boolean = false
k
oh, right, obvious now 😳
The guide is really complete and it is easy to find things, I think it should be pinned in the channel too
k
actually I read it a couple of times, and already have some data classes encoded like you suggested 😄 I just blanked out for a moment because I'm looking for a more general solution actually... replacing nulls with default Booleans or Enums is working fine, but sometimes depending if one or multiple fields are null I have to decode to another type all together...
I don't think there's a declarative way to do that, probably have to write a custom serializer for it...
👌 1