title: Android error String can't be converted to JSONArray
body: <p>This is my main activity. I cannot login as it says java.lang.String cannot be converted to JSONArray. What could be the error? I cannot resolve it.</p>
  
  <p>This is my main activity.java :</p>
  
  <pre><code>ppublic class MainActivity extends AppCompatActivity {
  private EditText email, password;
  private Button btn_login;
  private ProgressBar loading;
  private static String URL_LOGIN ="http://itsolutionsnepal.com/attendance/api/employeeLogin";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      loading= findViewById(R.id.loading);
      email = findViewById(R.id.editTextUserEmail);
      password = findViewById(R.id.editTextPassword);
      btn_login = findViewById(R.id.buttonRegister);
  
  
      btn_login.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              String mEmail = email.getText().toString().trim();
              String mPassword = password.getText().toString().trim();
  
              if (!mEmail.isEmpty() || !mPassword.isEmpty()) {
                  Login(mEmail, mPassword);
              }else{
                  email.setError("Please Enter Email");
                  password.setError("Please Enter Password");
  
              }
  
  
          }
      });
  
  }
  
  private void Login(final String email, final String password) {
      loading.setVisibility(View.VISIBLE);
      btn_login.setVisibility(View.GONE);
  
      StringRequest stringRequest = new StringRequest(Request.Method.POST,URL_LOGIN,
              new Response.Listener&lt;String&gt;() {
                  @Override
                  public void onResponse(String response) {
  
                      try {
                          JSONArray jsonArray = new JSONArray(response);
  
                          for (int i = 0; i &lt; jsonArray.length(); i++) {
                              JSONObject object = jsonArray.getJSONObject(i);
                              String name = object.getString("_first_name").trim();
                              String email =  object.getString("_email").trim();
  
                              //  JSONObject jsnobject = new JSONObject(response);
  //                            JSONArray jsonArray = jsnobject.getJSONArray("");
                             //JSONObject object = jsonArray.getJSONObject(i);
  
  
  //                            JSONObject jsonResponse = new JSONObject(response);
  //
  //                            JSONArray jsonArray = jsonResponse.getJSONArray("");
  
                          //JSONObject jsonObject = new JSONObject(response);
                         // Log.d("JSON", jsonObject.toString());
                          //String success = jsonObject.getString("");
                         // JSONArray jsonArray = jsonObject.getJSONArray("");
                       //   JSONArray jsonArray = new JSONArray(response);
                         // JSONObject jsonObject = new JSONObject("");
                       //   String code = jsonObject.getString("");
  
    //                            if (success.equals("1"))
     //                            {
  
    //                                    String name = 
   object.getString("_first_name").trim();
  //                                    String email = 
    object.getString("_email").trim();
  
  
   //                                    Toast.makeText(MainActivity.this, 
   "Success 
   Login \nYour name: "+name+"\nYour Email: "+email,
   //                                            Toast.LENGTH_LONG).show();
                              System.out.println("Value of response - " + 
  response);
  
                              System.out.println("First Name : " + name);
                              System.out.println("Email : " + email);
                                  Intent intent = new Intent(MainActivity.this, HomeActivity.class);
                                  intent.putExtra("name",name);
                                  intent.putExtra("email", email);
                                  startActivity(intent);
                              loading.setVisibility(View.GONE);
  
  
  
  
                              //}
  
                          }
  
  
                      } catch (JSONException e) {
                          e.printStackTrace();
                          loading.setVisibility(View.GONE);
                          btn_login.setVisibility(View.VISIBLE);
                          Toast.makeText(MainActivity.this, "Error" +e.toString(),
                                  Toast.LENGTH_SHORT).show();
  
                      }
  
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      Toast.makeText(MainActivity.this, "Error" +error.toString(),
                              Toast.LENGTH_LONG).show();
                      loading.setVisibility(View.GONE);
                      btn_login.setVisibility(View.VISIBLE);
  
                  }
              })
      {
          @Override
          protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
              Map&lt;String, String&gt; params = new HashMap&lt;&gt;();
              params.put("_email", email);
              params.put("_password", password);
              return params;
          }
      };
      RequestQueue requestQueue = Volley.newRequestQueue(this);
      requestQueue.add(stringRequest);
  
  }
  </code></pre>
  
  <p>And this is my json response:</p>
  
  <p><a href="https://i.stack.imgur.com/BVlM9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BVlM9.png" alt="enter image description here"></a></p>
  
  <p>Log cat:</p>
  
  <p><a href="https://i.stack.imgur.com/LjQG9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LjQG9.png" alt="enter image description here"></a></p>
  
  <p>Log cat:</p>
  
  <p><a href="https://i.stack.imgur.com/eDAOI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eDAOI.png" alt="enter image description here"></a></p>