https://kotlinlang.org logo
#announcements
Title
# announcements
a

adibfara

02/27/2017, 7:45 AM
Does Gson work well with Kotlin data classes?
m

mg6maciej

02/27/2017, 8:01 AM
adibfara: Yes.
👍 1
r

rwachol

02/27/2017, 8:01 AM
you can also checkout kotson
👍 1
a

adibfara

02/27/2017, 8:04 AM
does it work by default? or it needs some implementation?
f

frank

02/27/2017, 8:18 AM
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

adibfara

02/27/2017, 8:21 AM
Thanks frank , that's exactly my use case.
m

mg6maciej

02/27/2017, 8:22 AM
I tend not to even use
@SerializedName
.
And I started using moshi instead of gson recently.
a

adibfara

02/27/2017, 8:24 AM
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

mg6maciej

02/27/2017, 8:26 AM
It's supposedly faster, which matters on Android more than anywhere else. And I like hipster technologies. 🙂
👍 1
a

adibfara

02/27/2017, 8:28 AM
Thanks , I'll do a research 🙂
3 Views