diff --git a/JSONObject.java b/JSONObject.java index 5ca5a45bc..4e51ed389 100755 --- a/JSONObject.java +++ b/JSONObject.java @@ -387,9 +387,10 @@ public JSONObject accumulate(String key, Object value) throws JSONException { testValidity(value); Object object = this.opt(key); if (object == null) { - this.put(key, - value instanceof JSONArray ? new JSONArray().put(value) - : value); + //this is the modified line The old version would put the raw value + //this forces an array when the accumulate version is used + + this.put(key, new JSONArray().put(value)); } else if (object instanceof JSONArray) { ((JSONArray) object).put(value); } else {