假设我收到了这样的JSON响应:
什么是将一个
{
"status": true,
"data": {
"29": "Hardik sheth",
"30": "Kavit Gosvami"
}
}
我正在使用Retrofit来解析Json响应。根据这个答案,我将不得不使用Map<String, String>
,它将在Map中提供所有数据。现在我想要的是ArrayList<PojoObject>
。
PojoObject.class
public class PojoObject {
private String mapKey, mapValue;
public String getMapKey() {
return mapKey;
}
public void setMapKey(String mapKey) {
this.mapKey = mapKey;
}
public String getMapValue() {
return mapValue;
}
public void setMapValue(String mapValue) {
this.mapValue = mapValue;
}
}
什么是将一个
Map<key,value>
转换为List<PojoObject>
的最佳方法?
PojoObject
对象添加到列表中,问题出在哪里呢? - xander