I just started programming in Python (a couple of weeks ago) and have some difficulties when trying to replicate some functionalities available in JavaScript, specifically, JSON manipulations. I have a JSON array file loaded into a Python program and need to loop through the available tuples ordered based on the value of one key. The JSON file looks as follows: [ {"Order" : 1 , "Details" : {"Type" : "Move_Forward_Straight" , "Distance" : 100 , "Start_Velocity" : 10 , "End_Velocity" : 0 } }, {"Order" : 2 , "Details" : {"Type" : "Move_Arc" , "Radius" : 100 , "Angle" : 75 , "Velocity" : 70} }, {"Order" : 3 , "Details" : {"Type" : "Move_Backwards_Straight" , "Distance" : 176 } }, {"Order" : 4 , "Details" : {"Type" : "Move_Arc" , "Radius" : 120 , "Angle" :-90 , "Velocity" : 70} } ] Upon loading and printing the loaded content, the order of the elements within the tuples is changed. Though the order of tuples appears to be maintained, I'm not sure if I can rely on that and hence prefer to make sure the code "consumes" the records in the right order. Each record (tuple) contains instructions that need to be executed in the order assigned to element "Order". For each Type, there is a function that needs to be invoked with the available parameters. I can see two options here: Sort the array based on the value of the "Order"element and then loop based on the length (4 in this case); for this option, I would need to verify that the order of the tuples as shown in the loaded file is honored. Loop from 1 to 4 (returned length of the example above) and extract the tuple whose "Order"value is the index of the loop. I tried a number of examples but so far without success. Any suggestion will be highly appreciated. UPDATE: Following steve-ed's suggestion, I added the following few lines to test the code and hereinafter are the added code and the result: Added code: l_Index = 0 while (l_Index < 4): print("Details of index " + str(l_Index) + " are: " + str(l_Run_Details[l_Index]['Order']) + " - " + str(l_Run_Details[l_Index]['Details'])) l_Index = l_Index + 1 # End while. Result: Details of index 0 are: 1 - {'End_Velocity': 0, 'Type': 'Move_Forward_Straight', 'Distance': 100, 'Start_Velocity': 10} Details of index 1 are: 2 - {'Angle': 75, 'Radius': 100, 'Type': 'Move_Arc', 'Velocity': 70} Details of index 2 are: 3 - {'Distance': 176, 'Type': 'Move_Backwards_Straight'} Details of index 3 are: 4 - {'Angle': -90, 'Radius': 120, 'Type': 'Move_Arc', 'Velocity': 70} In order words, steve-ed's suggestion does solve my problem. Thank you Sir!!!! Continue reading...