json データを解析しようとしています
{
"000000000000000": [
{
"employee_boycode": "00",
"id": "000",
"address": "abcdef",
"name": "name",
"bankcode": "abc",
"branch_name": "abcd",
"account_no": "789"
}
]
}
データを解析するための私のコードは
JSONObject jsnJsonObject = new JSONObject(jsonResponse);//error coming here
contacts = jsnJsonObject.getJSONArray("000000000000000");
for (int i = 0; i < contacts.length(); i++)
{
JSONObject c = contacts.getJSONObject(i);
id = c.getString("id");
boy_code = c.getString("employee_boycode");
name = c.getString("name");
address = c.getString("address");
branch_name = c.getString("branch_name");
bankcode = c.getString("bankcode");
account_no = c.getString(account_no);
}
そして、私はエラーが発生しています
01-17 12:51:41.280: V/response is(481): {"000000000000000":[{"employee_boycode":"012","id":"100","address":"sdfsfsdfsdf","name":"karan","bankcode":"HDFC","branch_name":"SARANGPUR","account_no":"100"}]}
01-17 12:51:50.900: I/System.out(481): ServerEncodedResponse id 01-17 12:51:50.910: I/System.out(481): {"000000000000000":[{"employee_boycode":"012","id":"100","address":"sdfsfsdfsdf","name":"karan","bankcode":"HDFC","branch_name":"SARANGPUR","account_no":"100"}]}
01-17 12:52:14.950: W/return(481): r2
01-17 12:52:14.950: W/return(481): r3
01-17 12:52:20.951: D/SntpClient(70): request time failed: java.net.SocketException: Address family not supported by protocol 01-17
12:53:13.120: W/System.err(481): org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
01-17 12:53:13.210: D/dalvikvm(481): GC_FOR_MALLOC freed 3676 objects / 194656 bytes in 94ms
01-17 12:53:13.220: W/System.err(481): at org.json.JSON.typeMismatch(JSON.java:107)
01-17 12:53:13.220: W/System.err(481): at org.json.JSONObject.(JSONObject.java:158)
01-17 12:53:13.300: W/System.err(481): at org.json.JSONObject.(JSONObject.java:171)