import json with open("settings.json") as f: cfg = json.load(f) with open("project_settings.cmake", "w") as out: out.write(f'set(PROJECT_NAME "{cfg["project_name"]}")\n') out.write(f'set(CHIP "{cfg["chip"]}")\n') out.write(f'set(PORT "{cfg["port"]}")\n') out.write(f'set(BAUD "{cfg["flash_baud"]}")\n')