from ast import arg import sys import json # should pass the path of the appsettings.json file as the first argument # should pass the path of the .env file as the second argument # python3 turn_app_setting_json_to_dotenv.py appsettings.json config.env with open(sys.argv[1]) as file_obj: data = json.load(file_obj) dotenv_list = [] for setting in data: dotenv_list.append("{}={}".format(setting["name"], setting["value"])) # write dotenv_list to a file dotenv_file = open(sys.argv[2], "w") dotenv_file.write("\n".join(dotenv_list)) dotenv_file.close()