I am trying to build a list with data of a JSON object. However the order of the list does not match the oder of the JSON object and changes nearly everytime I run the code.
{
"project":{
"Projektnamen":{
"Server":{
"Server1":{
...
},
"Server2":{
...
},
"Server3":{
...
}
}
}
}
}
with open('json_data.json') as json_file:
# json CONFIG_JSON Konfigurationsdatei
CONFIG_JSON = json.load(json_file)
for key in CONFIG_JSON["project"]["Projektnamen"]["Server"]:
servernamen.append(key)
Expected result: servernamen = [Server1, Server2, Server3]
However the order always changes. Last result: servernamen = [Server3, Server1, Server2]