Write dict as JSON file

import json

def read_json(filename, data):
    with open(filename) as file_json:
        data = json.load(file_json)
        return data

import json

def write_json(filename, data):
    with open(filename, 'w') as file_json:
        json.dump(data, file_json)

Last updated

Was this helpful?