How can I stringify a list of optional strings with kotlinx serialization? I would like to execute something similar to:
val json = Json(JsonConfiguration.Stable)
val data: List<String?> = listOf("v1", null, "v3")
val dataJson = json.stringify(String.serializer().list, data)
However, this does not compile. I understand that String.serializer().list
provides a SerializationStrategy<List<String>>
where I need a SerializationStrategy<List<String?>>
. How can I acquire the latter?