GsonConverter在数据可用的情况下解析,但是当出现空值时,它不会解析数据。
这是json回复
{
"data": [{
"name": "abc store",
"services": [
[
"Travel Clinic",
"Growler Fill",
"Fresh Food"
]
]
}, {
"name": "abc store",
"services": [
[
"Travel Clinic",
"Coffee Bar",
"Growler Fill",
"Fresh Food",
"Scoop Ice Cream"
]
]
}, {
"name": "abc store",
"services": [
""
]
}]
}
这是模型 Model.java
{
private String name;
@SerializedName("services")
ArrayList<ArrayList<String>> storeServices;
}
我使用过这些依赖项:
com.squareup.retrofit2:converter-gson:2.1.0
com.squareup.retrofit2:retrofit:2.1.0
答案 0 :(得分:0)
我认为问题出在你的改造模型中。你能表现出来吗?
或试试这个
public class Example {
@SerializedName("services")
@Expose
public List<List<String>> services = null;
}