我已经试过http://www.jsonschema2pojo.org/解决这个问题,但它没有奏效。我想创建一个JSON响应类此JSON格式:你如何为这个Json文件设置一个使用Gson的响应类?
{
"Structure1": [
[
"StringValue1",
"StringValue2"
],
[
"StringValue1",
"StringValue2"
]
],
"Structure2": [
[
"StringValue1",
"StringValue2"
]
],
"Structure3": [
[
"StringValue1",
"StringValue2"
]
]
}
这里是我当前类的样子:
public class Response {
private HashMap<String, ArrayList<ArrayList<String>>> map = new HashMap<String, ArrayList<ArrayList<String>>>();
public HashMap<String, ArrayList<ArrayList<String>>> getMap() {
return map;
}
public void setFile11Txt(HashMap<String, ArrayList<ArrayList<String>>> map) {
this.map = map;
}
}
要分析我做
Response response = gson.fromJson(response, Response.class);
的返回的地图最终是空的,我做错了什么?
好友是你的回应字符串正确正在添加 – koutuk
是的,这一点是好的 – noobcoder
检查我张贴的答案 – koutuk