@app.get("/")
async def read_root():
# houses = json.load(open("data.json"))["houses"]["house"]
# return houses[0]["id"]
houses = json.load(open("data.json"))["houses"]["house"]
for house in houses:
return house["id"]
When I run the commented code, I receive "3070", which is working as intended, however when I try to loop it in the non-commented code, I also receive "3070" instead of a list of ids.
Can't figure this one out, thanks for the help :)
returnstatement ends the code which means it should be outside thefor..loop