diff --git a/src/api/miscellaneous/json.py b/src/api/miscellaneous/json.py index 10ec4945c834b5be3ef71721617741b81d9927e0..5e1c055a8c69b0b740b986f969927264f29fbb3b 100644 --- a/src/api/miscellaneous/json.py +++ b/src/api/miscellaneous/json.py @@ -90,10 +90,14 @@ class CJsonObject(CJsonValue): def get_array(self, key: str) -> "CJsonArray": return self.get(key).as_array() - def get_bool(self, key: str) -> bool: + def get_bool(self, key: str, default: bool or None = None) -> bool: + if default is not None and not self.has(key): + return default return self.get(key).as_bool() - def get_sint32(self, key: str) -> int: + def get_sint32(self, key: str, default: int or None = None) -> int: + if default is not None and not self.has(key): + return default return self.get(key).as_sint32() def get_int(self, key: str, min_value: int, max_value: int, optional: bool = False) -> int or None: