From a4717724853ce92888c8aa6c082a25428e00720b Mon Sep 17 00:00:00 2001 From: romangraef Date: Fri, 1 Jun 2018 11:07:02 +0200 Subject: added editing abilities --- json_serializable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'json_serializable.py') diff --git a/json_serializable.py b/json_serializable.py index 87db9d1..eedade6 100644 --- a/json_serializable.py +++ b/json_serializable.py @@ -1,7 +1,7 @@ import json from datetime import datetime from enum import Enum -from typing import Dict, Type, List +from typing import Dict, Type, List, Union def from_json(data, cls: Type): @@ -49,7 +49,7 @@ def prepare_json(obj): class JsonSerializable(object): @classmethod - def load(cls, data): + def load(cls, data: Union[str, dict]): if isinstance(data, str): data = json.loads(data) return from_json(data, cls) -- cgit