Doc updates, refactor code layout, python package

This commit is contained in:
Daniel G. Taylor
2019-10-18 21:07:12 -07:00
parent 811b54cabb
commit 7fe64ad8fe
9 changed files with 270 additions and 22 deletions

View File

@@ -633,9 +633,9 @@ class Message(ABC):
setattr(self, field.name, v)
return self
def to_json(self) -> str:
def to_json(self, indent: Union[None, int, str] = None) -> str:
"""Returns the encoded JSON representation of this message instance."""
return json.dumps(self.to_dict())
return json.dumps(self.to_dict(), indent=indent)
def from_json(self: T, value: Union[str, bytes]) -> T:
"""