title: JSONObject inside JSONArray
body: <p>I'm trying to put a JSONObject inside a JSONArray in Java. Here is my two objects:</p>
  
  <p>JSONArray:</p>
  
  <pre><code>[{
      "url": null,
      "flag": "0",
      "read": "0",
      "time": 2000,
      "exp": null,
      "population": 10
  }]
  </code></pre>
  
  <p>JSONObject:</p>
  
  <pre><code>{
  "events": [
      {
          "color": "Green",
          "event": "Restart"
      },
      {
          "color": "Black",
          "event": "Shutdown"
      },
      {
          "color": "White",
          "event": "Read"
      }       
  ]
  }
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>[
  {
      "url": null,
      "flag": "0",
      "read": "0",
      "time": 2000,
      "exp": null,
      "population": 10,
      "events": [
          {
              "color": "Green",
              "event": "Restart"
          },
          {
              "color": "Black",
              "event": "Shutdown"
          },
          {
              "color": "White",
              "event": "Read"
          }
      ]
  }
  ]
  </code></pre>
  
  <p>I tried to use this code, but the result is not ok:</p>
  
  <pre><code>jsonArray.put(jsonObject);
  </code></pre>
  
  <p>Unexpected result:</p>
  
  <pre><code>[
  {
      "url": null,
      "flag": "0",
      "read": "0",
      "time": 2000,
      "exp": null,
      "population": 10
  },
  {
      "events": [
          {
              "color": "Green",
              "event": "Restart"
          },
          {
              "color": "Black",
              "event": "Shutdown"
          },
          {
              "color": "White",
              "event": "Read"
          }
      ]
  }
  ]
  </code></pre>
  
  <p>The "events" key-value most be inside the unique element in JSONArray, not as another element.</p>