title: javax.json - Build JsonObject with arraylist and one separated attribute
body: <p>I have a method that should return a <code>Response</code> with a <code>JsonObject</code> (with arraylist) exactly like the code at the bottem of this article. This is a java <code>@GET</code> method. I know how to build a <code>jsonobject</code> with <code>json.createObjectBuilder</code> like:</p>
  
  <pre><code> JsonObject jo = Json.createObjectBuilder().add("name", "item").add("user", user.getUser()).build();
  </code></pre>
  
  <p>But I dont how to build like the code below.
  So I have to do an add with the name "items", this is an arraylist. Every item has four attributes: id, name, bool and another arraylist reserveItems (reserveItems can be null). After this I have to do an add with name length and value 687.</p>
  
  <pre><code>{
                "items" :[
                             {
                                "id"         : 1,
                                "name"       : "Item1",
                                "bool"       : true,
                                "reserveItems": []
                             },
                             {
                                "id"         : 2,
                                "name"       : "Item2",
                                "bool"       : false,
                                "reserveItem": []
                             }
                ],
                "length"  :687
      }
  </code></pre>