title: Add JsonArray to JsonObject
body: <p>I googled a lot today for this subject. But I can't find it, How can I add a JSONArray to a JSONObject?</p>
  
  <p>Because everytime I do this I get this error: Stackoverflow</p>
  
  <pre><code>        JSONObject fillBadkamerFormaatFromContentlet(Structure structure, String formaat) {
      JSONObject jsonObject = new JSONObject();
      JSONArray arr = new JSONArray();
  
      BadkamerFormaat badkamerFormaat = new BadkamerFormaat();
      BadkamerTegel badkamerTegel;
      List&lt;Contentlet&gt; contentlets = getContentletsByStructure(structure);
      badkamerFormaat.formaat = formaat;
      badkamerFormaat.tegels = new ArrayList&lt;BadkamerTegel&gt;();
  
      try {
          jsonObject.put("formaat", formaat); 
      } catch (JSONException e1) {
          throw new RuntimeException(e1);
      }
  
      for(Contentlet contentlet : contentlets) {
          badkamerTegel = new BadkamerTegel();
          badkamerTegel.naam = contentlet.getStringProperty(ParameterNames.toolBetegelVeldNaam);
          try {
              badkamerTegel.afbeeldingTegel = contentlet.getBinary(ParameterNames.toolBetegelVeldTegelAfbeelding).getPath();
              badkamerTegel.afbeeldingBadkamer = contentlet.getBinary(ParameterNames.toolBetegelVeldBadkamerAfbeelding).getCanonicalPath();
              arr.put(badkamerTegel.toJSON());
          } catch (IOException e) {
              throw new RuntimeException(e);
          }   
      }
  
      try {
          jsonObject.put("aoColumnDefs",arr);
      } catch (JSONException e) {
          throw new RuntimeException(e);
      }
  
      return jsonObject;          
  }
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>java.lang.StackOverflowError
  at com.dotmarketing.util.json.JSONArray.&lt;init&gt;(JSONArray.java:248)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  at com.dotmarketing.util.json.JSONObject.put(JSONObject.java:953)
  </code></pre>
  
  <p>The JSON I want: Only the last JsonArray is going wrong:</p>
  
  <pre><code>{
             "wand": [
          {
              formaat: 'vierkant15x15'
              tegels: [
                      {naam: '', imgThumb: '/bla/bla.png', largeImg: '/bla/bla2.png'}
                      ,{naam: '', imgThumb: '/bla/bla.png', largeImg: '/bla/bla2.png'}
                      ]
          }
          ,
  
          {
              formaat: 'vierkant17x15'
              tegels: [
                      {naam: '', imgThumb: '/bla/bla.png', largeImg: '/bla/bla2.png'}
                      ,{naam: '', imgThumb: '/bla/bla.png', largeImg: '/bla/bla2.png'}
                      ]
          }
      ]
  </code></pre>
  
  <p>,
              "vloer": [
              {
                  formaat: 'vierkant10x15'
                  tegels: [
                          {naam: '', imgThumb: '/bla/bla.png', largeImg: '/bla/bla2.png'}
                          ,{naam: '', imgThumb: '/bla/bla.png', largeImg: '/bla/bla2.png'}
                          ]
              }
              ,</p>
  
  <pre><code>        {
              formaat: 'vierkant45x15'
              tegels: [
                      {naam: '', imgThumb: '/bla/bla.png', largeImg: '/bla/bla2.png'}
                      ,{naam: '', imgThumb: '/bla/bla.png', largeImg: '/bla/bla2.png'}
                      ]
          }
      ]
  </code></pre>
  
  <p>}</p>