Skip to content

Commit 21e720f

Browse files
committed
Unsafe JSONObject fix
JSONObject extends HashMap new methods addUpdateListener and update with PropertyChangeListener
1 parent 525a9d0 commit 21e720f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/org/json/JSONArray.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,10 @@ public JSONArray put(Map<?, ?> value) {
10231023
return this.put(new JSONObject(value));
10241024
}
10251025

1026+
public JSONArray put(JSONObject value) {
1027+
return this.put((Object) value);
1028+
}
1029+
10261030
/**
10271031
* Append an object value. This increases the array's length by one.
10281032
*
@@ -1161,6 +1165,11 @@ public JSONArray put(int index, Map<?, ?> value) throws JSONException {
11611165
return this;
11621166
}
11631167

1168+
public JSONArray put(int index, JSONObject value) throws JSONException {
1169+
this.put(index, (Object) value);
1170+
return this;
1171+
}
1172+
11641173
/**
11651174
* Put or replace an object value in the JSONArray. If the index is greater
11661175
* than the length of the JSONArray, then null elements will be added as

0 commit comments

Comments
 (0)