json_util#

Functions:

api_default(obj)

json.dump "default" argument for sending objects over a JSON API.

api_encode(obj)

Recursively encode any object for transmission through the API.

api_object_hook(dct)

json.dump "object_hook" argument for receiving JSON from an API request.

binary_to_json(binary)

Encode bytes as a JSON-serializeable object

ndarray_from_json(dct)

Decode a serialized numpy array.

ndarray_to_json(arr)

Encode a numpy array a JSON-serializeable object.

api_default(obj: Any) Any#

json.dump “default” argument for sending objects over a JSON API. Ensures that special non-JSON types such as Path are NDArray are encoded correctly.

api_encode(obj: Any)#

Recursively encode any object for transmission through the API.

api_object_hook(dct: Mapping[str, Any])#

json.dump “object_hook” argument for receiving JSON from an API request. Ensures that special objects that are actually encoded numpy arrays or bytes are decoded as such.

binary_to_json(binary: bytes)#

Encode bytes as a JSON-serializeable object

ndarray_from_json(dct: Mapping[str, Any])#

Decode a serialized numpy array.

ndarray_to_json(arr: ndarray)#

Encode a numpy array a JSON-serializeable object.