首页 > Retrofit+OKHttp API需要上传JSONArray格式的数据,APIService应该怎么写??

Retrofit+OKHttp API需要上传JSONArray格式的数据,APIService应该怎么写??

1.Retrofit+OKHttp POST JSONArray怎么请求??


    /* 添加评论 */
    @POST("api/Comment")
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    Observable<ApiResponseBean> postComment(@Body RequestCommentBean commentBean);
new Retrofit.Builder()
                    .baseUrl(API_BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create())

直接用gson,把实体自动转json然后上传吧。

【热门文章】
【热门文章】