We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c163414 commit c317b3aCopy full SHA for c317b3a
json-smart/src/main/java/net/minidev/json/JSONObject.java
@@ -113,13 +113,16 @@ public String getAsString(String key) {
113
/**
114
* A Simple Helper cast an Object to an Number
115
*
116
+ * @see JSONParserBase.parseNumber(String s)
117
* @return a Number or null
118
*/
119
public Number getAsNumber(String key) {
120
Object obj = this.get(key);
121
if (obj == null)
122
return null;
- return (Number)obj;
123
+ if (obj instanceof Number)
124
+ return (Number)obj;
125
+ return Long.valueOf(obj.toString());
126
}
127
128
// /**
0 commit comments