Update JSONArray.java for #1007

fix array content starting with ',' in strict mode
This commit is contained in:
Michele Vivoda 2025-09-10 02:21:16 +02:00 committed by GitHub
parent 9b8eefc2de
commit 9de3005566
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,6 +105,8 @@ public class JSONArray implements Iterable<Object> {
if (nextChar == 0) {
// array is unclosed. No ']' found, instead EOF
throw x.syntaxError("Expected a ',' or ']'");
} else if (nextChar==',' && jsonParserConfiguration.isStrictMode()) {
throw x.syntaxError("Array content starts with a ','");
}
if (nextChar != ']') {
x.back();