I've this following code chunk using which i want to store the value in JSONObject in order to iterate over it and render it over front end.
JSONObject dlCovs = jsonObject.getJSONObject("result").getJSONObject("cov_details");
Iterator x = dlCovs.keys();
while (x.hasNext()){
String key1 = (String) x.next();
String value1 = dlCovs.optString(key1);
dlCovs.put("covabbrv",key1);
dlCovs.put("dcIssuedt",value1);
dlCovs.put("vecatg",key1);
dlData.put("dlCovs", dlCovs);
}
/* dlCovs.put("covabbrv",cov);
dlCovs.put("issue_date",issue_date);*/
dlObj.put("status","valid");
dlData.put("dlCovs", dlCovs);
dlData.put("status","valid");
while iterating over the data in while loop i'm getting java.util.concurrentModificationException, their is also a case when i'm trying to debug it it is storing the value in dlData.put("dlCovs",dlCovs), but as soon as it's coming for iteration for the second time it throws error. I've following JSON value
"cov_details": {
"MCWG": "NA",
"3WTR": "NA",
"PSV BUS": "NA",
"LMV": "NA",
"INVCRG": "NA"
},
Any help will be highly appreciable,thanks well in advance enter code here