Russell Cullen
11/01/2019, 2:31 PMDate?
from a String?
using a custom KSerializer<Date>
and it's working great, until the 3rd party API I'm using sends an empty string instead of null as expected. Is there a way to map this empty case to a null Date instead of a dummy-Date? It seems something like KSerializer<Date?>
is not supported, is that correct?Fudge
11/01/2019, 5:51 PMFudge
11/01/2019, 5:52 PMRussell Cullen
11/01/2019, 6:05 PMKSerializer<Date>
does not allow null return types. (And KSerializer<Date?>
does not match the Date?
types on my class for some reason)
How can I use .nullable
in an annotation? I assumed this was used under the hood already for me since my Date types are nullable.
At the end, I would like a deserializer that does the following:
String?
-> Date?
where null
or ""
maps to null: Date?
Kroppeb
11/03/2019, 12:37 AMdecodeNullableElement
of the compositedecoder which will most likely call decodeNotNullMark()
on the decoder which will return false if the next value is null.Kroppeb
11/03/2019, 12:39 AMRussell Cullen
11/03/2019, 1:07 AM