spotify / android-sdk

Spotify SDK for Android
https://developer.spotify.com/documentation/android/
Apache License 2.0
457 stars 117 forks source link

Support Moshi for json (de)serialization #111

Open gabrielittner opened 5 years ago

gabrielittner commented 5 years ago

SDK Version: 0.6.1

The SDK currently supports Gson and Jackson. We are currently migrating from Gson to Moshi and it would be great if the Spotify SDK could support it in the same way as it supports the other two. Moshi has a lot of advantages like proper support for Kotlin and nicer to use APIs. See also this comment by Jesse Wilson who worked on both https://www.reddit.com/r/androiddev/comments/684flw/why_use_moshi_over_gson/

AntoineGagnon commented 4 years ago

@gabrielittner Have you tried defining your own JsonMapper subclass that uses Moshi and pass it with .setJsonMapper ?

gabrielittner commented 4 years ago

Isn't that a Jackson API, requiring to have a dependency on it?

AntoineGagnon commented 4 years ago

Isn't that a Jackson API, requiring to have a dependency on it?

It seems to be part of the Spotify SDK, and only implements two functions that go from String -> Json object

gabrielittner commented 4 years ago

Then it might work. I'll take a deeper look, I wasn't able to find it in the javadocs when checking earlier.