Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions jamcodec/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,11 @@ def __init__(self, key_def: JamCodecTypeDef, value_def: JamCodecTypeDef):
def encode(self, value: Union[typing.Mapping, list]) -> JamBytes:

if isinstance(value, Mapping):
# Sort Map by keys
value = sorted(value.items(), key=lambda x: x[0])
value = value.items()

if type(value) is list:
# Sort by first item
value = sorted(value, key=lambda x: x[0])

# Encode length of Vec
data = VarInt64.encode(len(value))
Expand Down
Loading