chg: [internal] User faster method to convert bytes to str

pull/1134/head
Jakub Onderka 2024-01-16 21:56:34 +01:00
parent 85ac94cc1c
commit 8c23a2def7
1 changed files with 3 additions and 2 deletions

View File

@ -247,8 +247,9 @@ class AbstractMISP(MutableMapping, MISPFileCache, metaclass=ABCMeta):
option |= orjson.OPT_SORT_KEYS
if indent:
option |= orjson.OPT_INDENT_2
return dumps(self, default=pymisp_json_default, option=option).decode("utf-8")
# orjson dumps method returns bytes instead of bytes, to keep compatibility with json
# we have to convert output to str
return str(dumps(self, default=pymisp_json_default, option=option))
return dumps(self, default=pymisp_json_default, sort_keys=sort_keys, indent=indent)