How can I get keys in the first level in JSON in the same order as it is passed from angular js? Let's say bellow example.
my_dict = {
'key1': {...},
'key2': {...},
'key3': {...}
}
Now when I fetch first level keys in python, it is not giving me in the same order as passed. But for some reason, I want to fetch it in the same order as passed.
for item in my_dict:
print item
This gives bellow result.
key3
key2
key1
Q1 - Why python change it's order?
Q2 - For some reason i want it in the same order like ['key1','key2','key3']
. How can I fetch it?
I tried lots of thing on internet but not getting the solution. Downvoters give the reason, so I can improve my question.