mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -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");
|
throw this.syntaxError("Missing value");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strictMode) {
|
Object stringToValue = JSONObject.stringToValue(string);
|
||||||
Object stringToVal = JSONObject.stringToValue(string);
|
|
||||||
|
|
||||||
if (stringToVal instanceof Number || stringToVal instanceof Boolean) {
|
return strictMode ? getValidNumberOrBooleanFromObject(stringToValue) : stringToValue;
|
||||||
return stringToVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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