1

I am currently trying to obtain the names and addresses of restaurants in Hayward from the "best_restaurant" list in the Zomato API.

I have tried

response = requests.get(url, headers=header)

data = (response.json())

# print(data)

for item in data["best_rated_restaurant"]:
    print item["name"]

I am receiving the data for "best_rated_restaurant", but do not know how to get specific values within the data.

Does anyone know how I would go about retrieving information inside the data such as name, address, cuisine, etc...?

1 Answers1

1

You're almost there:

for item in data["best_rated_restaurant"]:
    print item['restaurant']['name']
    print item['restaurant']['location']['address']
    print item['restaurant']['cuisines']
mechanical_meat
  • 163,903
  • 24
  • 228
  • 223