Does Gson work well with Kotlin data classes?
# announcements
a
Does Gson work well with Kotlin data classes?
m
adibfara: Yes.
👍 1
r
you can also checkout kotson
👍 1
a
does it work by default? or it needs some implementation?
f
For me the combination of data classes and gson has worked without any issues. There was nothing that had to be configured. Though I'm also not making extensive use of all possibilities (only the
@SerializedName
annotation.
💯 1
a
Thanks frank , that's exactly my use case.
m
I tend not to even use
@SerializedName
.
And I started using moshi instead of gson recently.
a
Yes if you separate the local models from remote models and have a converter for them , you do not need the serializedname part.
whats the reason to prefer moshi over gson?
m
It's supposedly faster, which matters on Android more than anywhere else. And I like hipster technologies. 🙂
👍 1
a
Thanks , I'll do a research 🙂