When using Gson for the Retrofit Builder I use:
 Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(CustomAPI.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
How to add a JacksonConverterFactory to a Retrofit Builder?
Using
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-jackson:1.9.0'
as Gradle Dependencies
On the internet I can get the class for the factory, but this must be imported somehow, as in all the tutorials they use Gson. The reason I need Jackson is because the models provided by the company make use of Jackson formatters.
It's possible to achieve that using this code snippet
Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(WeCityAPI.BASE_URL)
            .addConverterFactory(JacksonConverterFactory.create())
            .build();
and retrofit2 as dependency?
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-jackson:2.1.0'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With