美文网首页
Retrofit2 使用Jsoniter作为Converter

Retrofit2 使用Jsoniter作为Converter

作者: jeepc | 来源:发表于2017-10-10 17:10 被阅读88次

Jsoniter是一个json解析器,详见Jsoniter官网

Retrofit2要使用Jsoniter解析json,需要自定义Converter,详见Jsoniter-Retrofit_Demo

使用方法:

1、添加依赖:compile'com.squareup.retrofit2:retrofit:2.3.0'

                      compile'com.jsoniter:jsoniter:0.9.15'

                      compile'com.jeepc.retrofit2:jsoniterconverter:2.3.0'

2、代码实现:Retrofit retrofit =newRetrofit.Builder()

                     .addConverterFactory(JsoniterConverterFactory.create())

                     .build();

有什么不足之处欢迎批评指正。

相关文章

网友评论

      本文标题:Retrofit2 使用Jsoniter作为Converter

      本文链接:https://www.haomeiwen.com/subject/rxcbyxtx.html