From 3958ad3e92a585bca707db474cfe3a7598b81246 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Tue, 12 Jul 2022 11:27:17 +0300 Subject: [PATCH] Common: Add IJSONSerializable interface --- monkey/common/utils/IJSONSerializable.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 monkey/common/utils/IJSONSerializable.py diff --git a/monkey/common/utils/IJSONSerializable.py b/monkey/common/utils/IJSONSerializable.py new file mode 100644 index 000000000..39eefbf90 --- /dev/null +++ b/monkey/common/utils/IJSONSerializable.py @@ -0,0 +1,15 @@ +from __future__ import annotations + +from abc import ABC, abstractmethod + + +class IJSONSerializable(ABC): + @classmethod + @abstractmethod + def from_json(cls, json_string: str) -> IJSONSerializable: + pass + + @classmethod + @abstractmethod + def to_json(cls, class_object: IJSONSerializable) -> str: + pass