diff --git a/byml/byml.py b/byml/byml.py index 7ac18f1..39d5beb 100644 --- a/byml/byml.py +++ b/byml/byml.py @@ -317,7 +317,8 @@ def _write_nonvalue_node(self, stream: typing.BinaryIO, data, node_to_offset_map elif isinstance(data, dict): stream.write(self._u8(NodeType.HASH)) stream.write(self._u24(len(data))) - for (key, value) in data.items(): + for key in sorted(data.keys()): + value = data[key] stream.write(self._u24(self._hash_key_table[key])) node_type = self._to_byml_type(value) stream.write(self._u8(node_type))