mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-08 03:24:27 +08:00
feat(#871-strictMode): add allowSingleQuote option, add enhancements and simplification
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user