How do I convert an OrderedDict
to a normal dictionary while preserving the same order?
The reason I am asking this is because is when I fetch my data from an API, I get a JSON string, in which I use json.loads(str)
to return a dictionary. This dictionary that is returned from json.loads(...)
is just out of order and is randomly ordered. Also, I've read that OrderedDict
is slow to work with so I want to use regular dict in same order as original JSON string.
Slightly off-topic: Is there anyway to convert a JSON string to a dict using json.loads(...)
while maintaining the same order without using collections.OrderedDict
?