faust.utils.json
¶
JSON utilities.
-
faust.utils.json.
str_to_decimal
(s: str, maxlen: int = 1000) → Optional[decimal.Decimal][source]¶ Convert string to
Decimal
.- Parameters
- Raises
ValueError – if length exceeds maximum length, or if value is not a valid number (e.g. Inf, NaN or sNaN).
- Return type
- Returns
Converted number.
- Return type
Decimal
-
class
faust.utils.json.
JSONEncoder
(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶ Faust customized
json.JSONEncoder
.Our version supports additional types like
UUID
, and importantly includes microsecond information in datetimes.
-
faust.utils.json.
dumps
(obj: Any, json_dumps: Callable = <function dumps>, cls: Type[faust.utils.json.JSONEncoder] = <class 'faust.utils.json.JSONEncoder'>, **kwargs: Any) → str[source]¶ Serialize to json. See
json.dumps()
.- Return type
-
faust.utils.json.
loads
(s: str, json_loads: Callable = <function loads>, **kwargs: Any) → Any[source]¶ Deserialize json string. See
json.loads()
.- Return type