Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo:
- def __init__(self, a, b, c):
- self.a, self.b, self.c = a, b, c
- def to_json(self):
- return json.dumps({'a': self.a, 'b': self.b, 'c': self.c})
- @classmethod
- def from_json(cls, content):
- return cls(**json.loads(content))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement