josdejong / josdejong/jsoneditor
Maintain formatting of float values like 1.0
Open
feature
- Dominant language
- JavaScript
- Stars
- 12.3k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
A float value such as 1.0 should remain 1.0 and not be changed to 1 i.e. without the .0 on the end.
I know this has been raised a number of time before but they have been closed incorrectly.
The JSON specification for Number DOES treat integers and floats differently. See the spec - https://www.json.org/. You will notice that when a period is given there MUST be a following digit even if that digit is zero. This is how floats are distinguished from integers in JSON. It is incorrect to strip the ".0" from the end of a float and turn it into an integer.
Contributor guide
Assessment
This issue has not been assessed yet.