mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-09 20:14:28 +08:00
#790 - Update XML with changes for string to number conversion.
Moved the code logic to a common utility to de-duplicate.
This commit is contained in:
@@ -331,7 +331,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
if (object instanceof Number) {
|
||||
return (Number)object;
|
||||
}
|
||||
return JSONObject.stringToNumber(object.toString());
|
||||
return NumberConversionUtil.stringToNumber(object.toString());
|
||||
} catch (Exception e) {
|
||||
throw wrongValueFormatException(index, "number", object, e);
|
||||
}
|
||||
@@ -1078,7 +1078,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
|
||||
if (val instanceof String) {
|
||||
try {
|
||||
return JSONObject.stringToNumber((String) val);
|
||||
return NumberConversionUtil.stringToNumber((String) val);
|
||||
} catch (Exception e) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user