We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fed023 commit 7d83534Copy full SHA for 7d83534
JSONObject.java
@@ -232,12 +232,13 @@ public JSONObject(JSONTokener x) throws JSONException {
232
throw x.syntaxError("Expected a ':' after a key");
233
}
234
235
- // Replace: this.putOnce(key, x.nextValue());
236
// Use syntaxError(..) to include error location
237
238
if (key != null) {
239
// Check if key exists
240
if (this.opt(key) != null) {
+ // back one token to point to the last key character
241
+ x.back();
242
throw x.syntaxError("Duplicate key \"" + key + "\"");
243
244
// Only add value if non-null
0 commit comments