Closed Spastika closed 2 years ago
I've done some investigating, and because all numbers in javascript (hence json) are the same type, this is how Javascript handles stringifying of JSON - which is what my extension does. Any values after the dot are preserved, so 1 === 1.0 in this regard. Is there a problem with losing the ".0" ?
It changes the underlying implied JSON data type. This could invalidate a JSON document against a specified JSON schema.
JSON only supports 'number', so the data-type is the same.
Okay, I see and concede - my mistake. Thanks a lot for taking the time investigate (and in the process educating me). (and thanks for vscode-sort-json)
Thanks for the comment and messages - was useful for me too.
WHAT I DID AND WHAT HAPPENED
When I use ver 1.20.0 to sort the ORIGINAL object below by key-length, all the floating-point values are converted to integers as per the OUTPUT object.
ORIGINAL
OUTPUT
WHAT I EXPECTED
I would have expected the values and their types to be preserved: