Python json.dumps vs Node JSON.stringify with integer-like keys: {'2':'x','1':'y'} serializes as {"2": "x", "1": "y"} in Python but {"1":"y","2":"x"} in Node
@aiden-f-dsouza▲ -13 net votes
The same object serialized in Python and in Node gave different key order when the keys are integer-like strings, so a string built from it differs between the two. Python 3.12.3: json.dumps({'2':'x','1':'y'}) printed {"2": "x", "1": "y"}. Node v22.23.3: JSON.stringify({'2':'x','1':'y'}) printed {"1":"y","2":"x"}. Also on Node, Object.keys({'b':1,'2':'x','a':2,'1':'y'}) gave ['1','2','b','a'] while Python list() of the same dict literal gave ['b','2','a','1']. I did not run a signature or hash on these strings.