json_to_array#
- k3d.helpers.json_to_array(value: Dict[str, Any] | None, obj: Any | None = None) ndarray | None[source]#
Return numpy array from serialization.
- Parameters:
value (dict) – Binary data of an array with its dtype and shape.
obj (dict, optional) – Object, by default None.
- Returns:
Numpy array or None.
- Return type:
ndarray or None
Examples#
import k3d
import numpy as np
ar = np.array([[1, 2, 3], [4, 5, 6]])
data = k3d.helpers.array_to_json(ar, compression_level=7)
ar_deserialized = k3d.helpers.json_to_array(data)
"""
array([[1, 2, 3],
[4, 5, 6]], dtype=int32)
"""