Serialize data as JSON and write to a file. :param obj: The data to serialize. :param fp: A file opened for writing text. Should use the UTF-8 encoding to be valid JSON. :param kwargs: May be passed to the underlying JSON library.
(self, obj: t.Any, fp: t.IO[str], **kwargs: t.Any)
| 47 | raise NotImplementedError |
| 48 | |
| 49 | def dump(self, obj: t.Any, fp: t.IO[str], **kwargs: t.Any) -> None: |
| 50 | """Serialize data as JSON and write to a file. |
| 51 | |
| 52 | :param obj: The data to serialize. |
| 53 | :param fp: A file opened for writing text. Should use the UTF-8 |
| 54 | encoding to be valid JSON. |
| 55 | :param kwargs: May be passed to the underlying JSON library. |
| 56 | """ |
| 57 | fp.write(self.dumps(obj, **kwargs)) |
| 58 | |
| 59 | def loads(self, s: str | bytes, **kwargs: t.Any) -> t.Any: |
| 60 | """Deserialize data as JSON. |