src/com/company/Server/ReadWriteFiles.java
public void removeUnregisteredUsers(int position) {
        try {
            JSONObject obj = (JSONObject) jsonParser.parse(new FileReader(file.getPath()));
            JSONArray listUsersUnregistered = (JSONArray) obj.get("UnregisteredUsers");

            listUsersUnregistered.remove(position);

            JSONArray county = (JSONArray) obj.get("Counties");
            JSONArray unregisteredUsers = (JSONArray) obj.get("Registry");

            JSONObject objWrite = new JSONObject();

            objWrite.put("UnregisteredUsers", listUsersUnregistered);
            objWrite.put("Registry", unregisteredUsers);
            objWrite.put("Counties", county);

            FileWriter fileWriter = new FileWriter(file.getPath());

            fileWriter.write(objWrite.toJSONString());

            fileWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
/**
     * Method responsible for removing the client from the JSON file, given its position in the array of registered clients
     *
     * @param position position of the removed client
     */
Method responsible for removing the client from the JSON file, given its position in the array of registered clients
@param position position of the removed client
Method responsible for removing the client from the JSON file given its position in the array of registered clients @param position position of the removed client
public void removeUnregisteredUsers(int position) {
        try {
            JSONObject obj = (JSONObject) jsonParser.parse(new FileReader(file.getPath()));
            JSONArray listUsersUnregistered = (JSONArray) obj.get("UnregisteredUsers");
            listUsersUnregistered.remove(position);
            JSONArray county = (JSONArray) obj.get("Counties");
            JSONArray unregisteredUsers = (JSONArray) obj.get("Registry");
            JSONObject objWrite = new JSONObject();
            objWrite.put("UnregisteredUsers", listUsersUnregistered);
            objWrite.put("Registry", unregisteredUsers);
            objWrite.put("Counties", county);
            FileWriter fileWriter = new FileWriter(file.getPath());
            fileWriter.write(objWrite.toJSONString());
            fileWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
public void removeUnregisteredUsers ( int position ) { try { JSONObject obj = ( JSONObject ) jsonParser . parse ( new FileReader ( file . getPath ( ) ) ) ; JSONArray listUsersUnregistered = ( JSONArray ) obj . get ( "UnregisteredUsers" ) ; listUsersUnregistered . remove ( position ) ; JSONArray county = ( JSONArray ) obj . get ( "Counties" ) ; JSONArray unregisteredUsers = ( JSONArray ) obj . get ( "Registry" ) ; JSONObject objWrite = new JSONObject ( ) ; objWrite . put ( "UnregisteredUsers" , listUsersUnregistered ) ; objWrite . put ( "Registry" , unregisteredUsers ) ; objWrite . put ( "Counties" , county ) ; FileWriter fileWriter = new FileWriter ( file . getPath ( ) ) ; fileWriter . write ( objWrite . toJSONString ( ) ) ; fileWriter . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; } }
Method responsible for removing the client from the JSON file, given its position in the array of registered clients
 @param position position of the removed client
Method responsible for removing the client from the JSON file given its position in the array of registered clients @param position position of the removed client