I am trying to access a JSON value from a python script. the value I am trying to access is "name" only, would really appreciate help in how can I do that using a python script the JSON data file is:
"restaurants": [
{
"restaurant": {
"R": {
"res_id": 9101083
},
"id": "9101083",
"name": "My Meat Wagon",
"url": "https://www.zomato.com/dublin/my-meat-wagon-smithfield?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1",
"location": {
"address": "Market Square, Smithfield, Dublin Dublin 7",
"locality": "Smithfield",
"city": "Dublin",
"city_id": 91,
"latitude": "53.3489980000",
"longitude": "-6.2788120000",
"zipcode": "Dublin 7",
"country_id": 97,
"locality_verbose": "Smithfield, Dublin"
},
in my test.py file I have
with open('data.json') as data_file:
data = json.load(data_file)
data["restaurant"]["name"]
print data
what should I do do have the program get the name of a restaurant only?