Conversation
|
This looks like an enhancement, not a bug fix. No changes to the API, but see below. The internal behavior has changed. Some data inputs may no longer be allowed, which will probably be unacceptable and should be avoided, invalid or not. The RFC does not seem to define numbers sharply, and allows implementations to restrict the range of numbers processed. Interoperability is mentioned as a concern, since users may assume that all implementations support the same ranges as what they use locally. JSON-Java advertises its numeric restrictions in the API contract: only double, long, int, and in places Number is supported. It would probably be advisable to add new API methods for BigDecimal and BigInteger in JSONObject, JSONArray, JSONWriter, etc. Other internal areas of the code may have to be touched as well. It seems reasonable to enhance JSON-Java to take a larger numeric range. Merging should not be performed until all code changes are completed and concerns addressed. Will this work for you? |
|
A new API for BigDecimal/BigInteger will be impossible without changing parsing and internal representation of numbers and that will ultimately change behaviour. |
|
We should shift discussion of support for BigDecimal and BigInteger to #126. If I missed something important to this issue, please bring it up there. I don't think other changes to the numeric behavior of JSON-Java will be able to get traction, given the need to maintain backwards compatibility. Thanks for bringing up the issue, hopefully it will lead to improved big number support. |
Use BigDecimal and BigInteger for numbers that will either be to precise for Double or to large for Long.
Since the conversion of Numbers changed, also some invalid notations of JSON-numbers that got parsed before will no longer be supported. @see differences between Double.valueOf(String s) and new BigDecimal(String s)