改进后单个和JsonArray参数

时间:2017-02-07 10:24:45

标签: android retrofit2 android-json

Json数据:

{
"userId":"5",
"name" : "mahdi",
"family" : "pishguy",
"id" : [{"1":"2333"},{"2":"12"},{"3":"123"}],
"token" : "10"
}

我想用这段代码发帖:

@Headers("Content-Type: application/json")
@POST("rst_store")
Call<User> saveUser(@Body User User);

Call<User> call = myService.saveUserSeeks(User);
call.enqueue(new Callback<User>() {
    @Override
    public void onResponse(Call<User> call, final Response<User> response) {
        if (response.isSuccessful()) {

        }
    }
    @Override
    public void onFailure(Call<User> call, Throwable t) {
        if (t.getMessage() != null) Log.e("Err: ", t.getMessage());
    }
});

我收到此错误:

Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

如何解决此问题?

谢谢。

0 个答案:

没有答案