Hi! How to handle correctly errors when my Kotlin ...
# android
i
Hi! How to handle correctly errors when my Kotlin
gson
models declares a field as non-optional but the api doesn't send it? It doesn't crash when setting the field, but appears to force a
null
in somehow and it crashes later when accessing it.
t
Had to move to kotlinx serialization few months ago, gson doesn’t respect kotlin nullability and that’s it
i
do you happen to know how kotlinx serialization compares to the moshi library someone else mentioned?
t
There are bunch benchmarks that contradict each other, but you can make decisions by going through Jesse's presentation https://speakerdeck.com/swankjesse/json-explained-chicago-roboto-2019?slide=34, kotlinx still has less features, doesn't use reflection on the positive side, supports kotlin multiplatform, and ofcourse best kotlin support
i
👍
Thanks!
👍 1