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

iex

04/29/2020, 8:39 PM
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

tjohnn

04/30/2020, 6:21 AM
Had to move to kotlinx serialization few months ago, gson doesn’t respect kotlin nullability and that’s it
i

iex

04/30/2020, 2:37 PM
do you happen to know how kotlinx serialization compares to the moshi library someone else mentioned?
t

tjohnn

05/03/2020, 8:59 AM
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

iex

05/03/2020, 9:51 AM
👍
Thanks!
👍 1
2 Views