[WIP] add float32 to JSON serialization (#1408)

* add float32 to JSON serialization

* Update util.py
This commit is contained in:
Tom Kralidis
2023-11-20 15:59:33 -05:00
committed by GitHub
parent 12ff009e6a
commit a1b7e70b88
+2 -2
View File
@@ -359,9 +359,9 @@ def json_serial(obj: Any) -> str:
return base64.b64encode(obj)
elif isinstance(obj, Decimal):
return float(obj)
elif type(obj).__name__ == 'int64':
elif type(obj).__name__ in ['int32', 'int64']:
return int(obj)
elif type(obj).__name__ == 'float64':
elif type(obj).__name__ in ['float32', 'float64']:
return float(obj)
elif isinstance(obj, l10n.Locale):
return l10n.locale2str(obj)