Android volley : org.json.JSONException: End of input at character 0 of (Using PDO)
<p>forgive me for possible duplicate, i have tried all the way that related my case, but still got nothing. </p>

<p>I this case i trying to display data from MySql using PDO.</p>

<p>this is my java response :</p>

<pre><code>  progressDialog.setMessage("Loading data..");
                RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
                JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, URL_GET_DATA, null,
                        new Response.Listener&lt;JSONObject&gt;() {
                            @Override
                            public void onResponse(JSONObject response) {
                                progressDialog.dismiss();
                                Log.d("TAG", "EXE : " + response.optString("nama"));
                                try {
                                    JSONArray jsonArray = response.getJSONArray("identitas");
                                    for (int i = 0; i &lt; jsonArray.length(); i++) {
                                        JSONObject jsonObject = jsonArray.getJSONObject(i);
                                        Toast.makeText(MainActivity.this, jsonObject.optString("nama"), Toast.LENGTH_SHORT).show();
                                    }
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                            }
                        },
                        new Response.ErrorListener() {
                            @Override
                            public void onErrorResponse(VolleyError error) {
                                Toast.makeText(MainActivity.this, "ERROR : " + error.getMessage(), Toast.LENGTH_SHORT).show();
                                progressDialog.dismiss();
                                Log.d("TAG", "ERROR : " + error.getMessage());
                                System.out.println("ERROR : " + error);
                            }
                        });
                requestQueue.add(request);
</code></pre>

<p>my php code to get all data :</p>

<pre><code>include "Connection.php";

class DisplayData {

    function getAllData(){
        $connection = new Connection();
        $conn = $connection-&gt;getConnection();

        $response = array();
        $response["identitas"] = array();

        try{
            $sql = "SELECT * FROM identitas";
                    $getData = $conn-&gt;prepare($sql);
                    $getData-&gt;execute();
                    if( $column = $getData-&gt;fetchColumn()&gt;0){//for count row

                        $result = $getData-&gt;fetchAll(PDO::FETCH_ASSOC);
                        foreach($result as $data) {
                            echo $data["nama"] . '&lt;br/&gt;';
                            echo $data["umur"] . '&lt;br/&gt;';
                            echo $data["jeniskel"] . '&lt;br/&gt;';

                            //--------------------display json
                            //temp user array
                            $identitas = array();
                            $identitas["nama"] = $data["nama"];
                            $identitas["umur"] = $data["umur"];
                            $identitas["jeniskel"] = $data["jeniskel"];
                            array_push($response["identitas"], $identitas);
                        }
                        $response["success"] = 1;
                        $response["message"] = "Success";
                        echo json_encode($response);
                    }else{
                        $response["success"] = 1;
                        $response["message"] = "No Product Found";
                        echo json_encode($response);
                    }
        }catch (PDOException $e){
            echo "Failed to display " . $e-&gt;getMessage();
        }
    }
}
</code></pre>

<p>json response should be like this :</p>

<pre><code>{  
   "identitas":[  
      {  
         "nama":"Kacang tanah jagoan",
         "umur":"16 tahun",
         "jeniskel":"Tumbuhan bencong"
      },
      {  
         "nama":"Kacang tanah jagoan",
         "umur":"16 tahun",
         "jeniskel":"Tumbuhan bencong"
      },
      {  
         "nama":"kacang",
         "umur":"19 tahun",
         "jeniskel":"laki laki"
      },
      {  
         "nama":"Beruang Kutub",
         "umur":"200 tahun",
         "jeniskel":"Jantan Kewanitaan"
      },
      {  
         "nama":"Arak",
         "umur":"44",
         "jeniskel":""
      },
      {  
         "nama":"nangka",
         "umur":"22",
         "jeniskel":"buah"
      },
      {  
         "nama":"jonat",
         "umur":"18",
         "jeniskel":"laki laki"
      },
      {  
         "nama":"jonat",
         "umur":"18",
         "jeniskel":"laki laki"
      },
      {  
         "nama":"polongs",
         "umur":"12",
         "jeniskel":"laki laki"
      },
      {  
         "nama":"Jas",
         "umur":"30",
         "jeniskel":"Musik"
      },
      {  
         "nama":"jaran goyang",
         "umur":"12",
         "jeniskel":"eeee"
      },
      {  
         "nama":"dd",
         "umur":"33",
         "jeniskel":"fddf"
      },
      {  
         "nama":"kavang",
         "umur":"89",
         "jeniskel":"ikk"
      },
      {  
         "nama":"jangar",
         "umur":"1",
         "jeniskel":"gfff"
      }
   ],
   "success":1,
   "message":"Success"
}
</code></pre>