ensure_serializable
Ensure items will serialize.
For a given list of arbitrary objects, return the object
or a string representation, safe for serialization.
def ensure_serializable(
items: Iterable[Any],
encoder: Callable
) - > tuple
Ensure items will serialize. For a given list of arbitrary objects, return the object or a string representation, safe for serialization.
Parameters
| Name | Type | Description |
|---|---|---|
| items | Iterable[Any] | A collection of arbitrary objects to be validated for serialization compatibility. |
| encoder | Callable | A function used to test if an object can be successfully serialized. |
Returns
| Type | Description |
|---|---|
tuple | A tuple containing the original objects if they are serializable, or their safe string representations if they are not. |