Reading JSON from a File


PHOTO EMBED

Tue Dec 08 2020 20:24:56 GMT+0000 (UTC)

Saved by @aymanelya #python

import json

with open('data.txt') as json_file:
    data = json.load(json_file)
    for p in data['people']:
        print('Name: ' + p['name'])
        print('Website: ' + p['website'])
        print('From: ' + p['from'])
        print('')
content_copyCOPY

https://stackabuse.com/reading-and-writing-json-to-a-file-in-python/