From 9de3005566acdc91de80ce58eeeab4fee36042c9 Mon Sep 17 00:00:00 2001 From: Michele Vivoda Date: Wed, 10 Sep 2025 02:21:16 +0200 Subject: [PATCH] Update JSONArray.java for #1007 fix array content starting with ',' in strict mode --- src/main/java/org/json/JSONArray.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/json/JSONArray.java b/src/main/java/org/json/JSONArray.java index c2e5c9a..7d12f98 100644 --- a/src/main/java/org/json/JSONArray.java +++ b/src/main/java/org/json/JSONArray.java @@ -105,6 +105,8 @@ public class JSONArray implements Iterable { 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();