I want to remove any JSON key/value pairs wherein the value is the empty string ""
or is the string literal null
. However Java enumerations don't like that and will throw a ConcurrentModificationException
if you attempt to remove the key and value.
JSONArray ja = loadJSONArray();
JSONObject firstJSON = ja.getJSONObject(0);
Iterator<?> iter = firstJSON.keys();
for (int i = 0; i < ja.length(); i++) {
JSONObject json = ja.getJSONObject(i);