unicode strings for check_json

This commit is contained in:
Pavel K 2016-06-04 21:18:09 +05:00
parent ac740e4755
commit 2f20d70e89
1 changed files with 6 additions and 1 deletions

View File

@ -62,9 +62,14 @@ class JsonDeserializable:
:param json_type:
:return:
"""
try:
str_types = (str, unicode)
except NameError:
str_types = (str,)
if type(json_type) == dict:
return json_type
elif type(json_type) == str:
elif type(json_type) in str_types:
return json.loads(json_type)
else:
raise ValueError("json_type should be a json dict or string.")