Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 改装-如何忽略表名_Android_Api_Rest_Retrofit_Retrofit2 - Fatal编程技术网

Android 改装-如何忽略表名

Android 改装-如何忽略表名,android,api,rest,retrofit,retrofit2,Android,Api,Rest,Retrofit,Retrofit2,我正在尝试从API中获取一些项,如下所示: { "picklist": [ { "name": "Abkhazia", "id": "a0511000002gxF1AAI" }, { "name": "Afghanistan", "id": "a0511000002gxF2AAI" }, { "name": "Akrotiri and Dhekelia", "id": "a0511000002gxF3AAI" }, { "name": "Albania", "id": "a0511000002

我正在尝试从API中获取一些项,如下所示:

{ "picklist": [ 
{ "name": "Abkhazia", "id": "a0511000002gxF1AAI" },
{ "name": "Afghanistan", "id": "a0511000002gxF2AAI" },
{ "name": "Akrotiri and Dhekelia", "id": "a0511000002gxF3AAI" },
{ "name": "Albania", "id": "a0511000002gxF5AAI" },
{ "name": "Algeria", "id": "a0511000002gxF6AAI" },
{ "name": "American Samoa", "id": "a0511000002gxF7AAI" }
] } 
我试着这样取:

public interface MyAPI {
    @GET("/?country=true")
    Call<List<User>> getUsers();
}

如何解决此问题?

您应该使用自定义响应来解决此问题:

public interface MyAPI {
    @GET("/?country=true")
    Call<APIResponse> getUsers();
}

class APIResponse {
    @JsonProperty("picklist") List<User> userList;
}

对于这种情况,您应该使用自定义响应:

public interface MyAPI {
    @GET("/?country=true")
    Call<APIResponse> getUsers();
}

class APIResponse {
    @JsonProperty("picklist") List<User> userList;
}

使用url和参数在postman中添加用户entitycheck。您的url或服务器响应一定有问题。请使用url和参数在postman中添加用户entitycheck。您的url或服务器响应一定有问题。
class APIResponse {
    List<User> picklist;
}