diff options
-rw-r--r-- | src/argaze/DataStructures.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/argaze/DataStructures.py b/src/argaze/DataStructures.py index 2fd691b..5648c0e 100644 --- a/src/argaze/DataStructures.py +++ b/src/argaze/DataStructures.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import collections +import json class DictObject(): """Convert dictionnary into object""" @@ -13,6 +14,9 @@ class DictObject(): def __getitem__(self, key): return self.__dict__[key] + def __str__(self): + return json.dumps({key: self.__dict__[key] for key in self.__dict__.keys()}, default=vars) + def type(self): return self.__type @@ -46,6 +50,9 @@ class TimeStampedBuffer(collections.OrderedDict): super().__setitem__(key, value) + def __str__(self): + return json.dumps(self, default=vars) + def pop_first(self): """Easing FIFO access mode""" return self.popitem(last=False)
\ No newline at end of file |