jsonify
Transform object making it suitable for json serialization.
def jsonify(
obj: Any,
builtin_types: tuple = (numbers.Real, str),
key: string = null,
keyfilter: callable = null,
unknown_type_filter: callable = null
) - > Any
Transform object making it suitable for json serialization.
Parameters
| Name | Type | Description |
|---|---|---|
| obj | Any | The source object to be transformed into a JSON-serializable format. |
| builtin_types | tuple = (numbers.Real, str) | A tuple of types that should be returned as-is without further transformation. |
| key | string = null | The dictionary key associated with the current object, used primarily for error reporting in nested structures. |
| keyfilter | callable = null | A predicate function used to determine which dictionary keys should be included in the output. |
| unknown_type_filter | callable = null | A fallback function to handle types not explicitly supported; if null, unsupported types will raise a ValueError. |
Returns
| Type | Description |
|---|---|
Any | A JSON-compatible representation of the input object, where complex types like dates and custom objects are converted to strings or dictionaries. |