josdejong / josdejong/jsoneditor
Format and Compact operations don't preserve object key order if keys parse as number
- Dominant language
- JavaScript
- Stars
- 12.3k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
If a JSON object contains keys which parse as number (for example, "00"), then pressing the Format and Compact buttons will change the order of the keys, which is unexpected.
Example:
```
{
"00": "0",
"01": "1",
"10": "2",
"11": "3"
}
```
Will be re-formatted to:
```
{
"10": "2",
"11": "3",
"00": "0",
"01": "1"
}
```
I also noticed that the Sort button produces nonsensical results with such keys. For example, sorting the above object by descending keys produces this order:
```
{
"10": "2",
"11": "3",
"01": "1",
"00": "0"
}
```
I got the same results with these versions:
- 5.10.0
- 6.0.0-beta.13
Contributor guide
Assessment
This issue has not been assessed yet.