python function to write json file

Python -- Posted on March 11, 2021

python function to write json file

              
                import json

def write_json_data(data, filename):
    with open('{}.json'.format(filename), 'w', encoding='utf-8') as f:
        json.dump(data, f, ensure_ascii=False, indent=4)
                  
   
            

Related Posts