<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_to_file(self, file_path: str) -> None: """ Serialize and write the data into a JSON file. """

        data = self.encode()
        with open(file_path, "w") as f:
            json.dump(data, f, indent=1)