feat(#871-strictMode): add allowSingleQuote option, add enhancements and simplification

This commit is contained in:
rikkarth
2024-03-30 11:06:30 +00:00
parent d2cb38dba7
commit c0918c2428
5 changed files with 58 additions and 30 deletions

View File

@@ -225,7 +225,7 @@ public class JSONObject {
case '}':
return;
default:
key = x.nextSimpleValue(c, jsonParserConfiguration.isStrictMode()).toString();
key = x.nextSimpleValue(c, jsonParserConfiguration).toString();
}
// The key is followed by ':'.
@@ -244,7 +244,7 @@ public class JSONObject {
throw x.syntaxError("Duplicate key \"" + key + "\"");
}
Object value = getValue(x, jsonParserConfiguration.isStrictMode());
Object value = x.nextValue(jsonParserConfiguration);
// Only add value if non-null
if (value != null) {
this.put(key, value);
@@ -272,12 +272,6 @@ public class JSONObject {
}
}
private Object getValue(JSONTokener x, boolean strictMode) {
if (strictMode) {
return x.nextValue(true);
}
return x.nextValue();
}
/**
* Construct a JSONObject from a Map.
*