code: def write_to_file(self, file_path: str) -> None:
          
          data = self.encode()
          with open(file_path, "w") as f:
              json.dump(data, f, indent=1)
docs: Serialize and write the data into a JSON file.