mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-02 11:05:28 -04:00
chore(#887): clean up parsedUnquotedText implementation
This commit is contained in:
parent
7cc19483fb
commit
ce13ebd5fe
@ -521,17 +521,17 @@ public class JSONTokener {
|
||||
throw this.syntaxError("Missing value");
|
||||
}
|
||||
|
||||
if (strictMode) {
|
||||
Object stringToVal = JSONObject.stringToValue(string);
|
||||
Object stringToValue = JSONObject.stringToValue(string);
|
||||
|
||||
if (stringToVal instanceof Number || stringToVal instanceof Boolean) {
|
||||
return stringToVal;
|
||||
}
|
||||
return strictMode ? getValidNumberOrBooleanFromObject(stringToValue) : stringToValue;
|
||||
}
|
||||
|
||||
throw new JSONException(String.format("Value is not surrounded by quotes: %s", string));
|
||||
private Object getValidNumberOrBooleanFromObject(Object value) {
|
||||
if (value instanceof Number || value instanceof Boolean) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return JSONObject.stringToValue(string);
|
||||
throw new JSONException(String.format("Value is not surrounded by quotes: %s", value));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user