Retrofit不进行Json解析,直接返回Json String

太长不看版
retrofit 可以得到String字符串的,使用JsonObject;

public interface APIService {

    @FormUrlEncoded
    @POST("tqt-system/code/phone")
    Call<JsonObject> postPhoneCode(@Field("phone") String phone);

    @FormUrlEncoded
    @POST("/tqt-system/login")
    Call<ResponseBody> postLogin(@Field("phone") String phone, @Field("code") String code, @Header("token") String token);


}

要注意区分 JsonObject 和 JSONObject!

也有说JsonConverterFactory 代替 GsonConverterFactory
JsonConverterFactory github地址: https://github.com/brokge/Retrofit2.0-JSONCoverter

猜你喜欢

转载自blog.csdn.net/qq_29983773/article/details/73245516