Remove TLObject.to_json

This commit is contained in:
Lonami Exo
2021-10-16 11:55:18 +02:00
parent b566e59036
commit dbe66bf805
2 changed files with 8 additions and 17 deletions

View File

@@ -125,23 +125,6 @@ class TLObject:
return res
def to_json(self, fp=None, default=_json_default, **kwargs):
"""
Represent the current `TLObject` as JSON.
If ``fp`` is given, the JSON will be dumped to said
file pointer, otherwise a JSON string will be returned.
Note that bytes and datetimes cannot be represented
in JSON, so if those are found, they will be base64
encoded and ISO-formatted, respectively, by default.
"""
d = self.to_dict()
if fp:
return json.dump(d, fp, default=default, **kwargs)
else:
return json.dumps(d, default=default, **kwargs)
def __bytes__(self):
try:
return self._bytes()