我試圖得到一些項目出來的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();
}
但由於該表有一個名稱它引發一個例外(至少我認爲這是爲什麼):
java.lang.IllegalStateException:
Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 3 path $
我該如何解決它?
郵遞員中添加用戶實體 –
檢查與網址,而params。網址或服務器響應必定存在問題。 –