Fixed orjson incompatibility with empty values from 4.x db schema

This commit is contained in:
Andrii V 2026-01-22 15:10:46 +01:00
parent e1a67b7306
commit a3465d8e83

View file

@ -82,8 +82,9 @@ class JSONEncodedObj(sqlalchemy.types.TypeDecorator):
try:
value = ext_json.json.loads(value)
except Exception:
if self.safe and self.default is not None:
return self.default()
if self.safe:
# Return default or empty dict for safety
return self.default() if self.default is not None else {}
else:
raise
return value