Sam Garfinkel
04/15/2020, 3:52 PMio.ktor.client.features.json.JsonSerializer.read(..)
return the nullable Any?
and why can’t the write
function accept Any?
? Is this just how they were designed, or is there an actual implementation constraint?Shawn
04/15/2020, 3:56 PMSam Garfinkel
04/15/2020, 3:57 PMkotlinx.serialization
which supports serializers for nullables.Shawn
04/15/2020, 4:01 PMnull
or a string that reads "null"
doesn’t fit the billSam Garfinkel
04/15/2020, 4:05 PMJson.parse(KSerializer<T>, String): T
, but because serializer(KType)
returns a KSerializer<Any?>
the built-in Json Serializer has to use the !!
operator. I guess this is kinda an esoteric discussion.suspend fun foo(): Bar? = client.get("<http://example.com>")
? Because read
can’t return null.