JSONSerializerDeserializer
#
- class gufe.custom_json.JSONSerializerDeserializer(codecs: Iterable[JSONCodec])#
Tools to serialize and deserialize objects as JSON.
This wrapper object is necessary so that we can register new codecs after the original initialization.
- encoder#
subclass of
JSONEncoder
; use asjson.dumps(obj, cls=encoder)
- decoder#
subclass of
JSONDecoder
; use asjson.loads(string, cls=decoder)
- Parameters:
codecs (list of
JSONCodec
s) – codecs supported
Methods
Add a new codec to the supported codecs
Callable to loads JSON
Callable that dumps to JSON
- add_codec(codec: JSONCodec)#
Add a new codec to the supported codecs
- Parameters:
codec (
JSONCodec
) – codec to add
- deserializer(string: str) Any #
Callable to loads JSON
- serializer(obj: Any) str #
Callable that dumps to JSON