-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsonvalue.cutOffPointZero(String s) #25
Comments
This change has been made in 3e3918e. IIRC, this was done because the trailing Could you explain why the trailing zeros are important in your project? |
I need a simple JSON-editor that can be used to modify values without changing their types. |
JSON defines the types string, number, array, object, and the literals |
You are right, there are just numbers in JSON and it does not make any distinction between integer and floating-point numbers.
|
Even if the implementation was changed as suggested, you'd get Anyway, I see your point. The fractional digits may contain relevant information, e.g. the value's precision. The JSON standard allows to convey this information, as it does not dictate to truncate zeros, however, minimal-json does not allow creating numbers in this format. I think that |
In my case
than this:
|
I can understand this requirement. There seem to be use cases for both modes, truncating and not truncating zeros. Maybe this should be configurable, e.g. |
Maybe an additional |
When setting values to floating point numbers which end on ".0" like this
jsonobject.set("test", (double) 21.0)
then the number is automatically truncated to an integer:
{"test":21}
If I set a double value then I would expect the result to be a double and not an integer.
I had to remove this method in my project to be able to differ between integer/long and float/double.
Is this method essential in some way?
The text was updated successfully, but these errors were encountered: