i want to make a condition when i call the json and make it to 'you cannot have the same thing' in the json value when you want to add more data to database. 

this is my code

```
String nim2, ruang2;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_kelas);
    nim = (EditText) findViewById(R.id.editNim);
    ruang = (EditText) findViewById(R.id.ruangPinjam);

    new daftarMahasiswa().execute();
}

public void nextButton (View view) {
    nim2 = nim.getText().toString();
    ruang2 = ruang.getText().toString();
    if (ruang2.equals(ruangan)) {
        Toast.makeText(KelasActivity.this, "this room has already borrow",Toast.LENGTH_LONG).show();
        ruang.setError("you cannot borrow the room again");
    }else if (nim2.equals(nimMahasiswa)){
        Toast.makeText(KelasActivity.this, "this NIM has borrow the room",Toast.LENGTH_LONG).show();
        nim.setError("you cannot borrow it again");
    }

class daftarMahasiswa extends AsyncTask<String, String, String> {
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(KelasActivity.this);
        pDialog.setMessage("Loading...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(false);
        pDialog.show();
    }

    @Override
    protected String doInBackground(String... params) {
        String link_url = "http://192.168.43.54/datapeminjamankelas/read_mahasiswa.php";
        JSONParser jParser = new JSONParser();
        JSONObject json = null;
        try {
            json = jParser.AmbilJson(link_url);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        try {
            str_json = json.getJSONArray("data");
            for (int i = 0; i < str_json.length(); i++) {
                JSONObject ar = str_json.getJSONObject(i);
                ruangan = ar.getString("ruang").trim();
                nimMahasiswa = ar.getString("nim").trim();
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    @Override
    protected void onPostExecute(String s) {
        pDialog.dismiss();
    }    
}

```

and this is my json

```
 {
  "data": [
    {
      "nim": "103452",
      "ruang": "2702"
    },
    {
      "nim": "102341",
      "ruang": "2504"
    },
    {
      "nim": "103421",
      "ruang": "1101"
    }
  ]
}

```

what i want to make is the 'nim' and the 'ruang' from json cannot be add again with the same value. it works honestly but only when the data just have 1, when it have more it dont work anymore. please help what can i put to make it right