title: Construct JSONArray with JSONObjects Dynamically Android
body: <p>for short: </p>
  
  <pre><code>Input =&gt;  1001,1002,1003...n
  Desired output =&gt; "recipients":[{"@id":"1001"},{"@id":"1002"},{"@id":"1003"},...n]
  </code></pre>
  
  <p>How can i convert the input into the desired JSONArray output.</p>
  
  <p>i started with </p>
  
  <pre><code>try {
      JSONArray mainArray = new JSONArray();
      JSONObject vm = new JSONObject();
      JSONObject content = new JSONObject();
      JSONObject content1 = new JSONObject();
  
      vm.put("@id", "10000");
      content.put("@id","10001");
      content1.put("@id","10002");
  
      mainArray.put(",");
  
  } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  </code></pre>
  
  <p>but i am not on the light way. Any idea ?</p>