I use ajax to get a JSON object from an external API. Here is the JSON object that I get :
"pricing_options": {
"7": {
"lodging_id": 7,
"lodging_url": "https://exampleapiurl.com/7",
"price": 520.0,
"name": "Private Room w/EnSuite Bath",
"max_occupancy": 2,
"image_url": "https://exampleapiurl.com/assets/282/2017/09/Karuna.jpg"
},
"552": {
"lodging_id": 552,
"lodging_url": "https://exampleapiurl.com/552",
"price": 400.0,
"name": "Private Room w/Queen Bed & Hall Bath",
"max_occupancy": 2,
"image_url": "https://exampleapiurl.com/assets/282/2019/03/Khandro-300x240.jpg"
},
"80": {
"lodging_id": 80,
"lodging_url": "https://exampleapiurl.com/80",
"price": 400.0,
"name": "Private Room w/Twin Bed & Hall Bath",
"max_occupancy": 1,
"image_url": "https://exampleapiurl.com/assets/282/2017/09/Basement-4-e1624825910642.jpg"
}
}
However, it keeps re-ordered automatically by its ID (7, 80, 552). I want to keep it that way (in the same exact order).