-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
The following piece of code surprisingly outputs class java.lang.String, instead of a number-class like BigDecimal or BigInteger.
import org.json.JSONException;
import org.json.JSONObject;
public class CodeTest {
public static void main(String[] args) throws JSONException {
String str = "{\"number_value\":9223372036854776000}";
JSONObject x = new JSONObject(str);
System.out.println(x.get("number_value").getClass());
}
}
Since JSON does not limit the size of numbers (to the best of my knowledge) I consider this to be a bug.
The culprit is JSONObject.stringToValue which will not work with numbers beyond the range of Java Long.
Metadata
Metadata
Assignees
Labels
No labels