To access the value of the user's name, you can use the key 'name' as follows:
user['name']
To access the value of the user's address, you can use the key 'Address' as follows:
user['Address']
To access the value of the user's subscription title, you can use the keys 'subscription' and 'title' as follows:
user['subscription']['title']
To access the value of the user's subscription cost, you can use the keys 'subscription' and 'cost' as follows:
user['subscription']['cost']
To access the value of the user's subscription validity month, you can use the keys 'subscription', 'valid_till', and 'month' as follows:
user['subscription']['valid_till']['month']
To access the value of the user's subscription validity year, you can use the keys 'subscription', 'valid_till', and 'year' as follows:
user['subscription']['valid_till']['year']
To access the value of the user's subscription validity date, you can use the keys 'subscription', 'valid_till', and 'date' as follows:
user['subscription']['valid_till']['date']
user = { 'name': 'Parker', 'Address' : 'London', 'subscription' : { 'title' : 'Student Bundle', 'cost' : 1000, 'valid_till' : { 'month': 'Jan', 'year': 2022, 'date': 2 } } }
1 answer