I've finally started learning Python and finished my first Udemy course, and started my project. I tried searching the forum but couldn't really find an answer to this directly.
I have an API request to an employee database in JSON, which simplified looks like this:
"Employees": {
"Arny Arnoldsen": {
"Employee_ID" : "0001",
"Title" : "Accounts Manager",
"Address 1" : "Cheery road 3",
"Address 2" : "Georgia"
},
"Burt Burtsen": {
"Employee_ID" : "0002",
"Title" : "Sales Manager",
"Address 1" : "Destiny street 23",
"Address 2" : "Las Vegas"
},
"Carl Carlsen": {
"Employee_ID" : "0003",
"Title" : "Operational Manager",
"Address 1" : "Sunshine road 42",
"Address 2" : "Miami"
}
}
To get my list of employes I just use
for employee in employees:
print(employee)
My second problem arises when I want to search for an employee using the Employee_ID. Because of GDPR etc etc I don't get any names, but might have f.eks. "Employee_ID" 0002 and I need to return Burt Burtsen.
I can look 'down' into dictionaries and lists, but can't seem to figure out how to do the opposite. I hope someone in here can help :)