title: Create a JSONObject in a JSONArray (JSON-Simple / JAVA)
body: <p>So, I'm getting a lot of troubles with adding a new JSONObject in my JSONArray.</p>
  
  <p>My code is in Spanish, so I'll try to traduct variables&amp;methods to English in my comments the best I can.</p>
  
  <p>This is my .JSON (the default user has all the attributs as "admin"):</p>
  
  <pre><code>{"Usuarios":[{"nombre":"Admin","apellido":"Admin","direccion":"Admin","telefono":"Admin","correo":"Admin@admin.com","username":"admin","password":"admin"}]}
  </code></pre>
  
  <p>First, of all, I've created functions, which can verify the attributes of my user "admin" without any problem. So, their isn't problems when reading the JSON file, only writing on it:</p>
  
  <p>So here is the problem, with this function:</p>
  
  <pre><code>public void agregarUsuario(String nombre, String apellido, String direccion, String telefono, String correo, String username, String password) //this function add a new user object to my array in the json
  {
      try {
          JSONObject usuarios = getJSONObjectFromFile("/usuarios.json"); //Json object "usuarios"/"users" is my main json obj file
          JSONArray listaUsuario = usuarios.getJSONArray("Usuarios");     //I've start my array "Usuarios" (who is in my .json)
          JSONObject newObject = new JSONObject();                        //I created a new JSONObjectVariable, with the attributes i want in it
          newObject.put("nombre", nombre);
          newObject.put("apellido", apellido);
          newObject.put("direccion", direccion);
          newObject.put("telefono", telefono);
          newObject.put("correo", correo);
          newObject.put("username",username);
          newObject.put("password", password);
                                                                          //at this point my new object has all the attributes i want to put in my array
          listaUsuario.put(newObject);                                    //so here i tried to put in my array my new Json object
          usuarios.put("Usuarios",listaUsuario);                          //this line, is one of my attempts to figure out how to put the function working
                                                                          //it wasn't in the first time, but how listaUsuario.put(newObject) dint make any change in my .json...
                                                                          //with or without it doesn't do anything 
      }catch(JSONException e) {
          e.printStackTrace();
      }
   }
  </code></pre>
  
  <p>This function who "writes" does not make any changes in my json file "/usuarios.json", but, i can actually read my json without problems; for example, this other function of my Project reads my json file to see if the password and usernames matches for the login JFrame:</p>
  
  <pre><code>public boolean verificarInicioDeUsuario(String incomeUsername,String incomePassword) {
     JSONArray listaUsuario = usuarios.getJSONArray("Usuarios"); //gets in my "Usuarios"/"User" array
     for(int j=0;j&lt;listaUsuario.length();j++) {                   //Start reading my array
          JSONObject user = listaUsuario.getJSONObject(j);        //i make a new JSONObject for use it to compare my strings
          if((user.getString("username").equals(incomeUsername))&amp;&amp;(user.getString("password").equals(incomePassword))) { //I compare my object username attributes with my incomeStrings
          return true;     //if the username and password matches in the same object, returns true
          }
       }
       return false; //if not, returns false
   }
  </code></pre>
  
  <p>Any suggestion/help? &lt;3</p>