Skip to content

Commit 7ead33b

Browse files
authored
YAML/JSON: Preserve Insertion Order (#64)
1 parent 71ebd60 commit 7ead33b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/pals/functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ def store_dict_to_file(filename: str, pals_dict: dict):
6363
if extension == ".json":
6464
import json
6565

66-
json_data = json.dumps(pals_dict, sort_keys=True, indent=2)
66+
json_data = json.dumps(pals_dict, sort_keys=False, indent=2)
6767
with open(filename, "w") as file:
6868
file.write(json_data)
6969

7070
elif extension == ".yaml":
7171
import yaml
7272

73-
yaml_data = yaml.dump(pals_dict, default_flow_style=False)
73+
yaml_data = yaml.dump(pals_dict, default_flow_style=False, sort_keys=False)
7474
with open(filename, "w") as file:
7575
file.write(yaml_data)
7676

0 commit comments

Comments
 (0)