https://kotlinlang.org logo
#serialization
Title
# serialization
d

Dominaezzz

07/29/2019, 9:14 AM
I have
data class Request(val mode: String = "default", val extra: String? = null)
, this produces
{ "mode": "default", "extra": null }
. Can I get it to omit the field entirely instead of setting it to
null
?
Json(encodeDefaults = false)
it seems.
👌 1
g

gildor

07/29/2019, 9:20 AM
hmmm, it’s really strange, looks like a bug, it shouldn’t encode null as string
"null"
d

Dominaezzz

07/29/2019, 9:21 AM
Oops, my bad. 😅
4 Views