title: Adding several JSONObject into one but not as an array
body: <p>I am working on a java API and I need to format some data into JSON. I want the following structure : <br></p>
  
  <pre><code>{
     "main": {
              "point1": {
                "x": 0.18,
                "y": 10.8,
                "z": 0
              },
              "point2": {
                "x": 0.18,
                "y": 9.36,
                "z": 0
              },
              "point3": {
                "x": 0.18,
                "y": 8.46,
                "z": 0
              },
              "point4": {
                "x": 0.18,
                "y": 7.38,
                "z": 0
              }
      }
  }
  </code></pre>
  
  <p>Basically there is a list of points in the "main" JSONObject object but I don't want it to be an array. </p>
  
  <pre><code>JSONObject main = new JSONObject();
  
  for(Point p : points){
      JSONObject point = new JSONObject();
      JSONObject coordinates = new JSONObject();
      coordinates.put("x", p.getX());
      coordinates.put("y", p.getY());
      coordinates.put("z", p.getZ());
      point.put(p.getName(),coordinates);
      main.put("main", point);
  }
  </code></pre>
  
  <p>I get the following result with the code above :</p>
  
  <pre><code>{
     "main": {
              "point4": {
                "x": 0.18,
                "y": 7.38,
                "z": 0
              }
      }
  }
  </code></pre>
  
  <p>The put method I use on the last line is overwritting the previous points, so I only got one point in the main object at the end. I guess the solution to my problem is trivial but I'm unable to find it. <br>
  Could you help me with that ? </p>