Ошибка Json: значение sl_summ типа java.lang.String не может быть преобразовано в JSON OBJECT

Как исправить эту ошибку. Надеюсь, вы можете мне посоветовать, как решить эту проблему. Я столкнулся с моим новым новшеством в программировании для Android. Я только следил за кодом в tutorail и вносил в него некоторые изменения.

После входа в систему будет Toast сообщение Json Error: Значение sl_summ типа java.lang.String не может быть преобразовано в JSONOBJECT, вот скриншот ошибки тоста после входа в систему

login.php

$user_sldtl = $db->getUserSLsummary($arclass, $loanclass, $accintreceivable, $date, $year, $month, $br_code, $clientid); If($user_sldtl != null) { for($i = 0; $i < count($user_sldtl); $i++){ $sl_response["error"] = FALSE; // $sl_response["sl_summ"]["sl_brcode"] = $user_sldtl[$i][0]; // $sl_response["sl_summ"]["sl_memid"] = $user_sldtl[$i][3]; $sl_response["sl_summ"]["sl_desc"] = $user_sldtl[$i][7]; $sl_response["sl_summ"]["tr_date"] = $user_sldtl[$i][10]; $sl_response["sl_summ"]["actual_balance"] = $user_sldtl[$i][14]; $sl_response["sl_summ"]["available_balance"] = $user_sldtl[$i][14]; json_encode($sl_response, true); echo json_encode($sl_response, true); //echo "<br>"; } } else { // echo "Member's data not found"."<br />"; // echo "Var dump: "; // var_dump($user); // echo " ->No record found"; $sl_response["error"] = TRUE; $sl_response["error_msg"] = "NO SL Details found!"; echo json_encode($sl_response); } 

Ответ JSON

этот ответ из таблицы участников.

 { "error":false, "user": { "br_code":12, "mem_id":13, "username":"test", "email":"test@yahoo.com" ,"created_at":"2016-07-22 09:05:21" } } 

этот ответ от sl_summ, этот пользователь имеет 2 строки в таблице

 { "error": false, "sl_summ": [ { "sl_desc": "PA : Savings Account", "tr_date": "2015-08-17", "actual_balance": "483.67", "available_balance": "483.67" }, { "sl_desc": "PA : Savings - Cash Bond", "tr_date": "2015-08-28", "actual_balance": "10129.43", "available_balance": "10129.43" } ] } 

SQLiteHandler.java

 public class SQLiteHandler extends SQLiteOpenHelper { private static final String TAG = SQLiteHandler.class.getSimpleName(); // All Static variables // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "coredev_gsacwp"; // Login table name private static final String TABLE_MEMBERS = "members"; private static final String TABLE_MEMBERS_SLDTL = "sldtl"; // Login Table Columns names private static final String BR_CODE = "br_code"; private static final String MEM_ID = "mem_id"; private static final String MEM_USERNAME = "username"; private static final String MEM_EMAIL = "email"; private static final String MEM_CREATED_AT = "created_at"; // Members SL Details private static final String SL_DESC = "sl_desc"; private static final String TR_DATE = "trans_date"; private static final String ACTUAL_BALANCE = "actual_balance"; private static final String AVAILABLE_BALANCE = "available_balance"; public SQLiteHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } // Creating Tables @Override public void onCreate(SQLiteDatabase db) { String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_MEMBERS + "(" + BR_CODE + " INTEGER," + MEM_ID + " INTEGER PRIMARY KEY," + MEM_USERNAME + " TEXT," + MEM_EMAIL + " TEXT UNIQUE," + MEM_CREATED_AT + " TEXT" + ")"; db.execSQL(CREATE_LOGIN_TABLE); //Members SLDTL table String CREATE_SLDTL_TABLE = "CREATE TABLE " + TABLE_MEMBERS_SLDTL + "(" + SL_DESC + " TEXT," + TR_DATE + " DATETIME," + ACTUAL_BALANCE + " REAL," + AVAILABLE_BALANCE + " REAL" + ")"; db.execSQL(CREATE_SLDTL_TABLE); Log.d(TAG, "Database table created"); } // Upgrading database @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_MEMBERS); db.execSQL("DROP TABLE IF EXISTS " + TABLE_MEMBERS_SLDTL); // Create tables again onCreate(db); } /** * Storing user details in database * */ public void addUser(String br_code, String mem_id, String username, String email, String created_at) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(BR_CODE, br_code); // branch code values.put(MEM_ID, mem_id); // mem id values.put(MEM_USERNAME, username); // username values.put(MEM_EMAIL, email); // Email values.put(MEM_CREATED_AT, created_at); // Created At // Inserting Row long id = db.insert(TABLE_MEMBERS, null, values); db.close(); // Closing database connection Log.d(TAG, "New user inserted into sqlite: " + id); } /** * Storing user SL details in database * */ public void addUserSLDTL(String sl_desc, String tr_date, String actual_balance, String avail_balance){ SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(SL_DESC, sl_desc); // sl desc values.put(TR_DATE, tr_date); // trans date values.put(ACTUAL_BALANCE, actual_balance); // actual balance values.put(AVAILABLE_BALANCE, avail_balance); // availabe balance // Inserting Row long id = db.insert(TABLE_MEMBERS_SLDTL, null, values); db.close(); // Closing database connection Log.d(TAG, "User SL Details inserted into sqlite: " + id); } /** * Getting user data from database * */ public HashMap<String, String> getUserDetails() { HashMap<String, String> user = new HashMap<String, String>(); String selectQuery = "SELECT * FROM " + TABLE_MEMBERS; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); // Move to first row cursor.moveToFirst(); if (cursor.getCount() > 0) { user.put("br_code", cursor.getString(0)); user.put("mem_id", cursor.getString(1)); user.put("username", cursor.getString(2)); user.put("email", cursor.getString(3)); user.put("created_at", cursor.getString(4)); } cursor.close(); db.close(); // return user Log.d(TAG, "Fetching user from Sqlite: " + user.toString()); return user; } /** * Getting user SL details data from database * */ public HashMap<String, String> getUserSLDTL() { HashMap<String, String> sl_summ = new HashMap<String, String>(); String selectQuery = "SELECT * FROM " + TABLE_MEMBERS_SLDTL; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); // Move to first row cursor.moveToFirst(); if (cursor.getCount() > 0) { sl_summ.put("sl_desc", cursor.getString(0)); sl_summ.put("tr_date", cursor.getString(1)); sl_summ.put("actual_balance", cursor.getString(2)); sl_summ.put("avail_balance", cursor.getString(3)); } cursor.close(); db.close(); // return user Log.d(TAG, "Fetching user from Sqlite: " + sl_summ.toString()); return sl_summ; } /** * Re create database Delete all tables and create them again * */ public void deleteUsers() { SQLiteDatabase db = this.getWritableDatabase(); // Delete All Rows db.delete(TABLE_MEMBERS, null, null); db.close(); Log.d(TAG, "All user info are now deleted in sqlite"); } /** * Re create database Delete all tables and create them again * */ public void deleteUserSLDTL() { SQLiteDatabase db = this.getWritableDatabase(); // Delete All Rows db.delete(TABLE_MEMBERS_SLDTL, null, null); db.close(); Log.d(TAG, "All user's SLDTL info are now deleted in sqlite"); } 

}

Login.java

 public class LoginActivity extends Activity { private static final String TAG = RegisterActivity.class.getSimpleName(); private Button btnLogin; private Button btnLinkToRegister; private EditText inputUsername; private EditText inputPassword; private ProgressDialog pDialog; private SessionManager session; private SQLiteHandler db; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); inputUsername = (EditText) findViewById(R.id.username); inputPassword = (EditText) findViewById(R.id.password); btnLogin = (Button) findViewById(R.id.btnLogin); btnLinkToRegister = (Button) findViewById(R.id.btnLinkToRegisterScreen); // Progress dialog pDialog = new ProgressDialog(this); pDialog.setCancelable(false); // SQLite database handler db = new SQLiteHandler(getApplicationContext()); // Session manager session = new SessionManager(getApplicationContext()); // Check if user is already logged in or not if (session.isLoggedIn()) { // User is already logged in. Take him to main activity Intent intent = new Intent(LoginActivity.this, MainActivity.class); startActivity(intent); finish(); } // Login button Click Event btnLogin.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { String username = inputUsername.getText().toString().trim(); String password = inputPassword.getText().toString().trim(); // Check for empty data in the form if (!username.isEmpty() && !password.isEmpty()) { // login user checkLogin(username, password); } else { // Prompt user to enter credentials Toast.makeText(getApplicationContext(), "Please enter the credentials!", Toast.LENGTH_LONG) .show(); } } }); // Link to Register Screen btnLinkToRegister.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Uri uri = Uri.parse("http://gsac.ph/iaccswebportal/register.php"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } }); } /** * function to verify login details in mysql db * */ private void checkLogin(final String username, final String password) { // Tag used to cancel the request String tag_string_req = "req_login"; pDialog.setMessage("Logging in ..."); showDialog(); StringRequest strReq = new StringRequest(Method.POST, AppConfig.URL_LOGIN, new Response.Listener<String>() { @Override public void onResponse(String response) { Log.d(TAG, "Login Response: " + response.toString()); hideDialog(); try { JSONObject jObj = new JSONObject(response); boolean error = jObj.getBoolean("error"); // Check for error node in json if (!error) { // user successfully logged in // Create login session session.setLogin(true); // Now store the user in SQLite //String uid = jObj.getString("uid"); JSONObject user = jObj.getJSONObject("user"); String br_code = user.getString("br_code"); String mem_id = user.getString("mem_id"); String username = user.getString("username"); String email = user.getString("email"); String created_at = user.getString("created_at"); // Inserting row in users table db.addUser(br_code, mem_id, username, email, created_at); try { JSONObject sl_jObj = new JSONObject("sl_summ"); Boolean sl_error = sl_jObj.getBoolean("error"); Log.e("Test", "Error : " + sl_error); if (!sl_error) { JSONArray sl_summ = sl_jObj.optJSONArray("sl_summ"); for (int i = 0; i < sl_summ.length(); i++) { JSONObject rootObj = sl_summ.getJSONObject(i); String sl_desc = rootObj.getString("sl_desc"); String tr_date = rootObj.getString("tr_date"); String actual_balance = rootObj.getString("actual_balance"); String avail_balance = rootObj.getString("avail_balance"); // then do whatever you want with this data // Inserting row in users table db.addUserSLDTL(sl_desc, tr_date, actual_balance, avail_balance); } } }catch (JSONException e) { // JSON error e.printStackTrace(); Toast.makeText(getApplicationContext(), "Json error: " + e.getMessage(), Toast.LENGTH_LONG).show(); } // Launch main activity Intent intent = new Intent(LoginActivity.this, MainActivity.class); startActivity(intent); finish(); } else { // Error in login. Get the error message String errorMsg = jObj.getString("error_msg"); Toast.makeText(getApplicationContext(), errorMsg, Toast.LENGTH_LONG).show(); } } catch (JSONException e) { // JSON error e.printStackTrace(); Toast.makeText(getApplicationContext(), "Json error: " + e.getMessage(), Toast.LENGTH_LONG).show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e(TAG, "Login Error: " + error.getMessage()); Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_LONG).show(); hideDialog(); } }) { @Override protected Map<String, String> getParams() { // Posting parameters to login url Map<String, String> params = new HashMap<String, String>(); params.put("username", username); params.put("password", password); return params; } }; // Adding request to request queue AppController.getInstance().addToRequestQueue(strReq, tag_string_req); } private void showDialog() { if (!pDialog.isShowing()) pDialog.show(); } private void hideDialog() { if (pDialog.isShowing()) pDialog.dismiss(); } 

}

Журнал сообщений

 Login Response: {"error":false,"user":{"br_code":12,"mem_id":13,"username":"test","email":"test@yahoo.com","created_at":"2016-07-22 09:05:21"}}<br /><br />{"error":false,"sl_summ":{"sl_desc":"PA : Savings Account","tr_date":"2015-08-17","actual_balance":"483.67","available_balance":"483.67"}}{"error":false,"sl_summ":{"sl_desc":"PA : Savings - Cash Bond","tr_date":"2015-08-28","actual_balance":"10129.43","available_balance":"10129.43"}} 06-22 16:07:30.456 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@48e3e97[LoginActivity]: dispatchDetachedFromWindow 06-22 16:07:30.470 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/InputTransport: Input channel destroyed: fd=85 06-22 16:07:30.478 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/SessionManager: User login session modified! 06-22 16:07:30.498 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/SQLiteHandler: New user inserted into sqlite: 13 06-22 16:07:30.499 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: org.json.JSONException: Value sl_summ of type java.lang.String cannot be converted to JSONObject 06-22 16:07:30.500 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at org.json.JSON.typeMismatch(JSON.java:111) 06-22 16:07:30.500 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at org.json.JSONObject.<init>(JSONObject.java:160) 06-22 16:07:30.501 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at org.json.JSONObject.<init>(JSONObject.java:173) 06-22 16:07:30.501 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at ph.coredev.johnjessbayutas.gsacmobileportal.activity.LoginActivity$3.onResponse(LoginActivity.java:147) 06-22 16:07:30.501 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at ph.coredev.johnjessbayutas.gsacmobileportal.activity.LoginActivity$3.onResponse(LoginActivity.java:116) 06-22 16:07:30.501 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:60) 06-22 16:07:30.501 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30) 06-22 16:07:30.501 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99) 06-22 16:07:30.501 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at android.os.Handler.handleCallback(Handler.java:751) 06-22 16:07:30.501 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) 06-22 16:07:30.501 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at android.os.Looper.loop(Looper.java:154) 06-22 16:07:30.502 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6692) 06-22 16:07:30.502 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at java.lang.reflect.Method.invoke(Native Method) 06-22 16:07:30.502 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) 06-22 16:07:30.502 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) 06-22 16:07:30.560 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@7c78859[LoginActivity]: MSG_WINDOW_FOCUS_CHANGED 1 06-22 16:07:30.564 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal E/ViewRootImpl: sendUserActionEvent() mView == null 06-22 16:07:30.579 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/InputTransport: Input channel constructed: fd=81 06-22 16:07:30.579 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@6834e69[Toast]: setView = android.widget.LinearLayout{60290ee VE..... ......I. 0,0-0,0} touchMode=true 06-22 16:07:30.604 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@7c78859[LoginActivity]: MSG_WINDOW_FOCUS_CHANGED 0 06-22 16:07:30.623 24346-24418/ph.coredev.johnjessbayutas.gsacmobileportal D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000, [907x245]-format:1 06-22 16:07:30.692 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/SQLiteHandler: Fetching user from Sqlite: {email=gsac_tabaco@yahoo.com, created_at=2016-07-22 09:05:21, br_code=12, mem_id=13, username=novalyn} 06-22 16:07:30.696 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/SQLiteHandler: Fetching user from Sqlite: {} 06-22 16:07:30.708 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/InputTransport: Input channel constructed: fd=85 06-22 16:07:30.708 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@bc7f138[MainActivity]: setView = DecorView@8f0f511[MainActivity] touchMode=true 06-22 16:07:30.709 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@6834e69[Toast]: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1 06-22 16:07:30.746 24346-24418/ph.coredev.johnjessbayutas.gsacmobileportal D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000, [1080x1920]-format:1 06-22 16:07:30.811 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@bc7f138[MainActivity]: MSG_RESIZED_REPORT: ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1 06-22 16:07:30.811 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@bc7f138[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 06-22 16:07:30.813 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@38d1e4e nm : ph.coredev.johnjessbayutas.gsacmobileportal ic=null 06-22 16:07:30.814 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus 06-22 16:07:30.825 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/InputTransport: Input channel constructed: fd=98 06-22 16:07:30.825 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/InputTransport: Input channel destroyed: fd=79 06-22 16:07:30.839 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal W/IInputConnectionWrapper: finishComposingText on inactive InputConnection 06-22 16:07:31.258 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@7c78859[LoginActivity]: dispatchDetachedFromWindow 06-22 16:07:31.272 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/InputTransport: Input channel destroyed: fd=84 06-22 16:07:34.027 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@6834e69[Toast]: dispatchDetachedFromWindow 06-22 16:07:34.037 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/InputTransport: Input channel destroyed: fd=81 06-22 16:08:04.047 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@a5db6f nm : ph.coredev.johnjessbayutas.gsacmobileportal ic=null 06-22 16:08:04.048 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus 06-22 16:08:04.055 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/InputTransport: Input channel constructed: fd=80 06-22 16:08:04.056 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/InputTransport: Input channel destroyed: fd=98 06-22 16:08:09.686 24346-24346/ph.coredev.johnjessbayutas.gsacmobileportal D/ViewRootImpl@bc7f138[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 

Из того, что я вижу в вашем журнале сообщений, является то, что вы пытаетесь преобразовать это:

 Login Response: {"error":false,"user":{"br_code":12,"mem_id":13,"username":"test","email":"test@yahoo.com","created_at":"2016-07-22 09:05:21"}}<br /><br />{"error":false,"sl_summ":{"sl_desc":"PA : Savings Account","tr_date":"2015-08-17","actual_balance":"483.67","available_balance":"483.67"}}{"error":false,"sl_summ":{"sl_desc":"PA : Savings - Cash Bond","tr_date":"2015-08-28","actual_balance":"10129.43","available_balance":"10129.43"}} 

в JSONObject.

И я вижу по крайней мере 2 ошибки в этом:

  • Существует некоторый HTML-элемент: <br /><br /> , который нужно удалить первым.
  • Существует несколько файлов JSON

Таким образом, после удаления элементов HTML вам необходимо либо:

  • Разберите этот ответ и сделайте несколько объектов JSON;
  • Или создайте массив JSON из вашего ответа на вход.

Вы можете использовать этот веб-сайт для проверки своего JSON.

Это происходит из-за вашего тега <br /> в ответ.

У вас есть ваш ответ как

 Login Response: {"error":false,"user":{"br_code":12,"mem_id":13,"username":"test","email":"test@yahoo.com","created_at":"2016-07-22 09:05:21"}}<br /><br />{"error":false,"sl_summ":{"sl_desc":"PA : Savings Account","tr_date":"2015-08-17","actual_balance":"483.67","available_balance":"483.67"}}{"error":false,"sl_summ":{"sl_desc":"PA : Savings - Cash Bond","tr_date":"2015-08-28","actual_balance":"10129.43","available_balance":"10129.43"}} 

эти теги из-за вас php-код.

Также ваш sl_summ не является jsonArray. Его объект Json.

 { "error":false, "sl_summ": { "sl_desc":"PA : Savings Account", "tr_date":"2015-08-17", "actual_balance":"483.67", "available_balance":"483.67" } } { "error":false, "sl_summ": { "sl_desc":"PA : Savings - Cash Bond", "tr_date":"2015-08-28", "actual_balance":"10129.43", "available_balance":"10129.43" } } 

поэтому, когда вы пишете JSONArray sl_summ = sl_jObj.optJSONArray("sl_summ"); Этот JsonObject не преобразован в JsonArray, что, в свою очередь, дает вам ошибку.

Вы должны исправить свой json как,

 { "error":false, "sl_summ": [{ "sl_desc":"PA : Savings Account", "tr_date":"2015-08-17", "actual_balance":"483.67", "available_balance":"483.67" }, { "sl_desc":"PA : Savings - Cash Bond", "tr_date":"2015-08-28", "actual_balance":"10129.43", "available_balance":"10129.43" }] } 

Измените jsonobect для sl_summ как это

  JsonObject json = new JsonObject(response); if(json.has("sl_summ"){ JSONObject sl_jObj = new JSONObject(json.getString("sl_summ")); }