2016-04-25 232 views
0

这是我的json数组,其中有子数组。现在我想在android中以安排的方式存储这个子数组的数据。就像先记录另一个,等等..我该怎么做?如何将我的JSON数组元素存储在变量中?

{ 
    "result": [ 
     ["", "", "2016-04-22", "", "", "problems since last 5 days", "replace piping", "0", null], 
     ["Elec4820", "", "2016-04-25", "", "", "jsjshdjdjjcncnc", "hdjdhdhfbbff", "0", null], 
     ["Elec7558", "", "2016-04-25", "", "", "jsjshdjdjjcncnc", "hdjdhdhfbbff", "0", null], 
     ["Gara8118", "11827", "2016-03-13", "Completed", "nknm", "too much garbage near front gate causing an unbearable stink.", "garbage ", "0", null], 
     ["Nois6091", "17061", "2016-03-11", "Assigned", "Committee Member has been assigned to solve this problem", "too much noise caused by construction carried out by....ccd . .dvdv efv \r\nvvevv ", "cdhvdhb bbcsjc cincs nenvnjk \r\nvndjkn n cnicjisk m \r\niejnivn vvnveivnievnj invjievivn \r\nvienvncn", "1", null], 
     ["Wate6487", "14371", "2016-03-14", "In-Progress", "gyghbn", "fegrtb fbvrv ", "ss", "1", null] 
    ] 
} 
+0

你的json数组在哪里?基本上你需要做的是为内容创建一个模型类,然后使用Gson库将其解析为ListArray Nativ

回答

0

你的模型类必须是类似的东西:

public class Example { 

@SerializedName("result") 
@Expose 
private List<List<String>> result = new ArrayList<List<String>>(); 

/** 
* 
* @return 
* The result 
*/ 
public List<List<String>> getResult() { 
return result; 
} 

/** 
* 
* @param result 
* The result 
*/ 
public void setResult(List<List<String>> result) { 
this.result = result; 
} 

} 

后,读GSON的文档,要做到这一点:https://github.com/google/gson

0

,同时通过子阵列解析JSON循环,并添加哈希集是哪里声明模型

相关问题