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 is not a bug actually.
Unespected and, in my opinion, uwanted behavior of the JSON.stringify method.
Gave me issues because I was storing a very basic list of ordered high-scores in a dictionary, with names as keys and scores as values.
Initially I thought there was a problem with my sorting algorythm, so it took me a while to find out that the method was resorting my data.
In my opinion the sort_keys: bool parameter should be false by default
Steps to reproduce
example code:
var data = { "b": 1000, "a": 200 } print(data) print(JSON.stringify(data))
Note that the JSON format does not guarantee insertion order, so the the alphabetical sorting may be enabled by default to guarantee some form of consistency when retrieving data back as a Dictionary.
Tested versions
Reproducible in v4.3.stable.official [77dcf97]
System information
Windows 10 - v4.3.stable.official [77dcf97]
Issue description
This is not a bug actually.
Unespected and, in my opinion, uwanted behavior of the JSON.stringify method.
Gave me issues because I was storing a very basic list of ordered high-scores in a dictionary, with names as keys and scores as values.
Initially I thought there was a problem with my sorting algorythm, so it took me a while to find out that the method was resorting my data.
In my opinion the sort_keys: bool parameter should be false by default
Steps to reproduce
example code:
var data = {
"b": 1000,
"a": 200
}
print(data)
print(JSON.stringify(data))
will print
{ "b": 1000, "a": 200 }
{"a":200,"b":1000}
Minimal reproduction project (MRP)
json-stringify.zip
The text was updated successfully, but these errors were encountered: