Fix failing tests and add safe json serializer
This commit is contained in:
@@ -1058,7 +1058,12 @@ def create_uuid_from_string(val: str):
|
||||
|
||||
|
||||
def json_dumps(data, indent=2):
|
||||
return json.dumps(data, indent=indent, ensure_ascii=False)
|
||||
def safe_serializer(obj):
|
||||
if isinstance(obj, datetime):
|
||||
return obj.isoformat()
|
||||
raise TypeError(f"Type {type(obj)} not serializable")
|
||||
|
||||
return json.dumps(data, indent=indent, default=safe_serializer, ensure_ascii=False)
|
||||
|
||||
|
||||
def json_loads(data):
|
||||
|
||||
Reference in New Issue
Block a user