Json Проблема:
У меня есть этот формат JSON
{
"Table1":[
{
"TableName":"LoadDistributor",
"Description":"Distributor ",
"MandatoryFlag":"1",
"Status":"",
"Priority":"0"
},
{
"TableName":"LoadPrice",
"Description":"Price ",
"MandatoryFlag":"1",
"Status":"",
"Priority":"0"
},
{
"TableName":"LoadProduct",
"Description":"Product ",
"MandatoryFlag":"1",
"Status":"",
"Priority":"0"
},
{
"TableName":"RD.AlternativeProductDetail",
"Description":"AltProdutDetail",
"MandatoryFlag":"0",
"Status":"",
"Priority":"0"
},
{
"TableName":"XA.vwTown",
"Description":"Town ",
"MandatoryFlag":"1",
"Status":"",
"Priority":"0"
}
]}
Android Json Метод обработки:
public String[] getStringArrayResponseJson(SoapPrimitive node, ArrayList<String> strings) {
try{
String result = node.toString();
JSONObject json = new JSONObject(result);
// Parsing
JSONArray nameArray = json.names();
JSONArray valArray = json.toJSONArray(nameArray);
Log.i("@@@" , "===="+ valArray.length());
for (int i = 0; i < valArray.length(); i++) {
strings.add(valArray.getString(i));
}
json.put("sample key", "sample value");
Log.i("REST", "<jsonobject>\n" + json.toString()
+ "\n</jsonobject>");
}catch (JSONException e) {
e.printStackTrace();
}
MyТребуется, чтобы я хотел получить TableName в строку [] или список ... Как мы можем это сделать?
Пожалуйста, помогите мне, что является ошибкой в моем методе обработки json:?