Partidas BOM y partes para SCAI
This commit is contained in:
@@ -29,8 +29,14 @@ def serialize_value(value: Any) -> Any:
|
||||
elif isinstance(value, dict):
|
||||
return {key: serialize_value(val) for key, val in value.items()}
|
||||
else:
|
||||
# For any other type, try to return as-is (str, int, float, bool, None)
|
||||
# If it fails JSON serialization later, at least we tried
|
||||
if hasattr(value, "__dict__"):
|
||||
d = dict(value.__dict__)
|
||||
d.pop("_sa_instance_state", None)
|
||||
return {k: serialize_value(v) for k, v in d.items()}
|
||||
|
||||
if not isinstance(value, (int, float, str, bool)):
|
||||
return str(value)
|
||||
|
||||
return value
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user