declearn.utils.add_json_support
Add or modify JSON (de)serialization support for a custom type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cls |
Type[Any]
|
Type for which to add (or modify) JSON (de)serialization support. |
required |
pack |
Callable[[Any], Any]
|
Function used to pack objects of type |
required |
unpack |
Callable[[Any], Any]
|
Function used to unpack objects of type |
required |
name |
Optional[str]
|
Keyword to use as a marker for serialized instances of type |
None
|
repl |
bool
|
Whether to overwrite any existing specification for type |
False
|
Source code in declearn/utils/_json.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|