Closed as duplicate of#69643
Description
Bug report
Bug description:
json dump sort_keys is not consistent or idempotent
This seems to have never been mentioned anywhere I can find in prior bug discussions like bug #69643. This would apparently be solved by the pull request linked from bug #69643. However this bug at least theoretically could be solved without solving bug #69643. (I certainly think both should be solved.)
When loading and re-dumping JSON, with no modification to the data, suddenly the keys all get re-sorted for types that don't sort the same in the original form vs the JSON-compliant string form.
>>> json.dumps({2:2,10:10},sort_keys=1)
'{"2": 2, "10": 10}'
>>> json.dumps(json.loads(json.dumps({2:2,10:10})),sort_keys=1)
'{"10": 10, "2": 2}'
CPython versions tested on:
3.13
Operating systems tested on:
No response