Note that there are some explanatory texts on larger screens.

plurals
  1. POJson parsing type mismatch error in android
    primarykey
    data
    text
    <p>I'm trying to parse my json data</p> <pre><code>{ "000000000000000": [ { "employee_boycode": "00", "id": "000", "address": "abcdef", "name": "name", "bankcode": "abc", "branch_name": "abcd", "account_no": "789" } ] } </code></pre> <p>my code for parsing the data is</p> <pre><code>JSONObject jsnJsonObject = new JSONObject(jsonResponse);//error coming here contacts = jsnJsonObject.getJSONArray("000000000000000"); for (int i = 0; i &lt; 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); } </code></pre> <p>and i'm getting error </p> <pre><code>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) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload