This closes #693

This commit is contained in:
jbertram 2016-08-01 12:57:37 -05:00
commit ae47eae5a7
1 changed files with 18 additions and 0 deletions

View File

@ -325,6 +325,24 @@ public final class JsonUtil {
return jsonValue.toString(); return jsonValue.toString();
} }
} }
else if (jsonValue instanceof Number) {
Number jsonNumber = (Number)jsonValue;
if (desiredType == Integer.TYPE || desiredType == Integer.class) {
return jsonNumber.intValue();
}
else if (desiredType == Long.TYPE || desiredType == Long.class) {
return jsonNumber.longValue();
}
else if (desiredType == Double.TYPE || desiredType == Double.class) {
return jsonNumber.doubleValue();
}
else if (desiredType == Short.TYPE || desiredType == Short.class) {
return jsonNumber.shortValue();
}
else {
return jsonValue;
}
}
else if (jsonValue instanceof Object[]) { else if (jsonValue instanceof Object[]) {
Object[] array = (Object[]) jsonValue; Object[] array = (Object[]) jsonValue;
for (int i = 0; i < array.length; i++) { for (int i = 0; i < array.length; i++) {