Python 术语表
json.dumps() 方法有参数可以对结果中的键进行排序:
json.dumps()
使用 sort_keys 参数指定结果是否应该排序:
sort_keys
json.dumps(x, indent=4, sort_keys=True)
亲自试一试