You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is similar to the previously resolved issue #826, which addressed the regression where strings starting with a '0' were incorrectly converted to integers. (fixed, as of 20240303, as noted in #868)
However, this new issue concerns decimal numbers that start with a '0', which are still being converted incorrectly in the latest version of the library.
JSONObject o = XML.toJSONObject(xml); // keep strings false
Output (on v20240303):
12345.6789 // leading zero omitted
0123456789
While issue #826 resolved the problem of handling integers starting with '0', this particular edge case with decimal numbers was not addressed. As a result, the current behavior strips the leading zero from the decimal number, converting 012345.6789 into 12345.6789, which is not the expected behavior in our case.
It seems there is a mismatch in behavior between how the library handles integer strings and decimal string numbers starting with '0'. Is it possible to handle decimal numbers in a way that preserves the leading zeros as part of the string, without requiring keepStrings=true, which would otherwise undesirably affect the conversion of other data types like booleans and integers?
Thank you for your attention to this issue.
The text was updated successfully, but these errors were encountered:
@Justsvetoslavov This project tries to offer more flexibility for XML/JSON transformations. Feel free to reopen this issue if you would like this specific behavior addressed.
This issue is similar to the previously resolved issue #826, which addressed the regression where strings starting with a '0' were incorrectly converted to integers. (fixed, as of 20240303, as noted in #868)
However, this new issue concerns decimal numbers that start with a '0', which are still being converted incorrectly in the latest version of the library.
XML
we use:
Output (on v20240303):
While issue #826 resolved the problem of handling integers starting with '0', this particular edge case with decimal numbers was not addressed. As a result, the current behavior strips the leading zero from the decimal number, converting
012345.6789
into12345.6789
, which is not the expected behavior in our case.It seems there is a mismatch in behavior between how the library handles integer strings and decimal string numbers starting with '0'. Is it possible to handle decimal numbers in a way that preserves the leading zeros as part of the string, without requiring
keepStrings=true
, which would otherwise undesirably affect the conversion of other data types like booleans and integers?Thank you for your attention to this issue.
The text was updated successfully, but these errors were encountered: