I am posting the form and then grabbing the json to form the dict .
myd = \
{'a': {'b': 'c1', 'd': 'f1'},
'b': {'bb': 'c2', 'dd': 'f2'},
'c': {'bbb': 'c3', 'ddd': 'f3'}
}
Now I am using josn.loads to convert that into python dict
I am doing this
headers = DefaultOrderedDict(list, json.loads(request.POST.get('myd')))
Can I do an ordered, default dict in Python?
after doing that my order of the dict gets changed like this
myd = \
{'a': {'b': 'c1', 'd': 'f1'},
'c': {'bbb': 'c3', 'ddd': 'f3'},
'b': {'bb': 'c2', 'dd': 'f2'},
}
How can I maintain the order?