Skip to content

Latest commit

 

History

History
33 lines (31 loc) · 967 Bytes

README.md

File metadata and controls

33 lines (31 loc) · 967 Bytes

converter-fastjson

Simple request and response body converter for retrofit2(https://github.com/square/retrofit) via fastjson(https://github.com/alibaba/fastjson)

Download

maven
<dependency>
    <groupId>cn.deathdealer</groupId>
    <artifactId>converter-fastjson</artifactId>
    <version>0.0.1</version>
</dependency>

Usage

    Retrofit retrofit = new Retrofit.Builder()
        .baseUrl("https://api.github.com")
        .addConverterFactory(FastjsonConverterFactory.create())
        .client(new OkHttpClient())
        .build();

or

    FastJsonConfig fastjsonConfig = new FastJsonConfig();
    Retrofit retrofit = new Retrofit.Builder()
        .baseUrl("https://api.github.com")
        .addConverterFactory(FastjsonConverterFactory.create().config(fastjsonConfig))
        .client(new OkHttpClient())
        .build();

Requirements

  • fastjosn version 1.2.x or above
  • retrofit version 2.x or above