1import json
2
3with open('path_to_file/person.json') as f:
4 data = json.load(f)
5
6print(data)
1import json
2
3# with json load (file)
4info = open('data.json',)
5res = json.load(info)
6print(res)
7print("Datatype after deserialization : " + str(type(res)))
8#>>> {'name': 'Dave', 'City': 'NY'}
9#>>> Datatype of the serialized JSON data : <class 'dict'>
1import json
2
3with open('data.json') as json_file:
4 data = json.load(json_file)
5 for p in data['people']:
6 print('Name: ' + p['name'])
7 print('Website: ' + p['website'])
8 print('From: ' + p['from'])
9 print('')
1with open('distros.json', 'r') as f:
2 distros_dict = json.load(f)
3
4for distro in distros_dict:
5 print(distro['Name'])