fixed some strict mode issues 980

This commit is contained in:
marilynel
2025-07-13 12:41:17 -08:00
parent f0a78aff61
commit fdaeb486ed
3 changed files with 59 additions and 1 deletions

View File

@@ -511,6 +511,15 @@ public class JSONTokener {
throw this.syntaxError("Missing value");
}
Object obj = JSONObject.stringToValue(string);
// if obj is a boolean, look at string
if (jsonParserConfiguration != null &&
jsonParserConfiguration.isStrictMode() && obj instanceof Boolean) {
if (!"true".equals(string) && !"false".equals(string)) {
throw this.syntaxError(String.format("Strict mode error: Value '%s' is not lowercase boolean", obj));
}
}
// Strict mode only allows strings with explicit double quotes
if (jsonParserConfiguration != null &&
jsonParserConfiguration.isStrictMode() &&