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