Skip to content
Discussion options

You must be logged in to vote

It's a bit messy but you can turn the dict into a sorted OrderedDict first, I think this would work:

from collections import OrderedDict


message_dict = json.loads(message) 
message_dict_s = OrderedDict(sorted(message_dict.items()))

Replies: 1 comment

Comment options

andrewleech
Dec 20, 2023
Collaborator Sponsor

You must be logged in to vote
0 replies
Answer selected by kakopappa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants