def to_json_file(self, path, file_name=None):
        """Writes output to a JSON file with the given file name"""
        if bool(path) and os.path.isdir(path):
            self.write_to_json(path, file_name)
        else:
            self.write_to_json(os.getcwd(), file_name)
Writes output to a JSON file with the given file name