Save the content of this instance in JSON format inside `json_path`.
(self, json_path: str)
| 141 | self.stateful_callbacks = stateful_callbacks |
| 142 | |
| 143 | def save_to_json(self, json_path: str): |
| 144 | """Save the content of this instance in JSON format inside `json_path`.""" |
| 145 | json_string = json.dumps(dataclasses.asdict(self), indent=2, sort_keys=True) + "\n" |
| 146 | with open(json_path, "w", encoding="utf-8") as f: |
| 147 | f.write(json_string) |
| 148 | |
| 149 | @classmethod |
| 150 | def load_from_json(cls, json_path: str): |