title: how to build a JsonObject using a particular jsonfromat
body: <p>I'm trying to access an API from my java code. The API only accepts data in the form of a JSON object, but I'm having trouble building a <code>JsonObject</code> representation.</p>
  
  <p>What I want to do is use <code>createObjectBuilder()</code> to create a <code>JsonObject</code> formatted as follows:</p>
  
  <pre><code>{
      "user1234@gmail.com": {
          "username" : "user1234@gmail.com",
          "password" : "password1",
          "service" : [ "yourkit" ]
      }
  }
  </code></pre>
  
  <p>I tried this:</p>
  
  <pre><code>JSONObject jsonObject = (JSONObject)Json.createObjectBuilder()
                              .add(
                                  username,
                                  Json.createObjectBuilder()
                                      .add("username", username)
                                      .add("password", password)
                                      .add("service", service)
                              ).build();
  
  p.setEntity(new StringEntity(jsonObject.toString(), "UTF-8")); 
  HttpResponse r = c.execute(p);
  </code></pre>
  
  <p>But it doesn't send the correct request to the API.</p>
  
  <p>Can someone please help me?</p>