https://kotlinlang.org logo
#android
Title
# android
l

locke

02/28/2018, 8:35 PM
Is there a way to force Gson to discard any JSON object with null properties when marshaling into Kotlin's non-null data classes? I am working with a client's backend and can't guarantee they won't break their contract, but also don't want nullable objects floating through the entirety of an application.
stackoverflow 6
r

rakeeb

03/01/2018, 1:36 AM
could
GsonBuilder().serializeNulls().create()
do the trick?
n

nat

03/01/2018, 4:13 AM
@locke if you found an answer, i would love to hear from you
d

dave08

03/04/2018, 3:26 AM
#klaxon does that I think, also maybe Moshi with Kotshi (I didn't try the latter).
4 Views