I want to make a Arraylist with JSON Objects .
There is a loop which gives me JSON Objects. I want to put them into a ArrayList.
Here is the Code which gives me JSON Objects. Please let me know how to put all the values ito a ArrayList
for (int i=0; i<10; i++) {
String datapointsBodyString = "{items:[{id:" + unionUptimeMetadata.getLatencyTimeseriesIds().get(i) + ", start: " + oldestTimeString + ",end: " + now + ", granularity: 1m}]}";
JSONObject datapointsBodyObject = new JSONObject((datapointsBodyString));
HttpResponse uptimeResponse = httpService.POST("url", datapointsBodyObject.toString(), unionUptimeTimeseriesHeaders);
HttpEntity uptimeResponseEntity = uptimeResponse.getEntity();
String uptimeResponseString = EntityUtils.toString(uptimeResponseEntity);
JSONObject uptimeResponsObject = new JSONObject(uptimeResponseString);
}
Thanks in advance.