I'm using Retrofit with Gson, and and when some fi...
# squarelibraries
p
I'm using Retrofit with Gson, and and when some field is incorrect, I'm not receiving an exception until try to read the value - only then I'm getting a
NullPointerException
Is there a way to enable exceptions for non null fields when deserialization fails?
y
You'll probably get an answer here, but isn't this more a GSON question? Something you would need to configure on your com.google.gson.Gson instance?
k
Answer is no. Because that is why people don't use gson with kotlin. It doesn't understand kotlin null ability. Use Moshi or kotlinx.serialization...
👍 1