Encoders¶
MyJSONEncoder¶
MyJSONEncoderDecimalsAsString¶
MyJSONEncoderDecimalsAsFloat¶
Methods¶
MyJSONEncoder_dumps¶
Help on function MyJSONEncoder_dumps in module pydicts.myjsonencoder:
MyJSONEncoder_dumps(r, indent=4)
Serializes a Python object to a JSON formatted string using MyJSONEncoder.
Args:
r (any): The Python object to serialize.
indent (int, optional): The indentation level for pretty-printing. Defaults to 4.
Returns:
str: The JSON formatted string.
MyJSONEncoder_loads¶
Help on function MyJSONEncoder_loads in module pydicts.myjsonencoder:
MyJSONEncoder_loads(s)
MyJSONEncoderDecimalsAsString_dumps¶
Help on function MyJSONEncoderDecimalsAsString_dumps in module pydicts.myjsonencoder:
MyJSONEncoderDecimalsAsString_dumps(r, indent=4)
Serializes a Python object to a JSON formatted string using MyJSONEncoderDecimalsAsString.
Decimal objects will be represented as strings.
MyJSONEncoderDecimalsAsString_loads¶
Help on function MyJSONEncoderDecimalsAsString_loads in module pydicts.myjsonencoder:
MyJSONEncoderDecimalsAsString_loads(s)
MyJSONEncoderDecimalsAsFloat_dumps¶
Help on function MyJSONEncoderDecimalsAsFloat_dumps in module pydicts.myjsonencoder:
MyJSONEncoderDecimalsAsFloat_dumps(r, indent=4)
Serializes a Python object to a JSON formatted string using MyJSONEncoderDecimalsAsFloat.
Decimal objects will be represented as floats (potential loss of precision).
MyJSONEncoderDecimalsAsFloat_loads¶
Help on function MyJSONEncoderDecimalsAsFloat_loads in module pydicts.myjsonencoder:
MyJSONEncoderDecimalsAsFloat_loads(s)
Deserializes a JSON formatted string into a Python object, attempting to
reconstruct custom types. Specifically, it expects Decimal objects to have
been serialized as floats.
Args:
s (str): The JSON formatted string.
Returns:
any: The deserialized Python object.