Skip to content

unienv_interface.transformations.serialization_utils

Serialization utilities for DataTransformations.

Provides functions to serialize/deserialize DataTransformation objects to/from JSON-compatible dictionaries.

Functions:

Name Description
transformation_to_json

Serialize a DataTransformation to a JSON-compatible dictionary.

json_to_transformation

Deserialize a DataTransformation from a JSON-compatible dictionary.

transformation_to_json

transformation_to_json(
    transformation: DataTransformation, source_space: Optional[Space] = None
) -> Dict[str, Any]

Serialize a DataTransformation to a JSON-compatible dictionary.

Parameters:

Name Type Description Default
transformation DataTransformation

The transformation to serialize.

required
source_space Optional[Space]

Optional source space context used by transforms that need backend/device information during serialization.

None

Returns:

Name Type Description
dict Dict[str, Any]

A JSON-compatible representation of the transformation.

json_to_transformation

json_to_transformation(
    json_data: Dict[str, Any], source_space: Optional[Space] = None
) -> DataTransformation

Deserialize a DataTransformation from a JSON-compatible dictionary.

Parameters:

Name Type Description Default
json_data Dict[str, Any]

The dictionary containing the transformation data.

required
source_space Optional[Space]

Optional source space context used by transforms that need backend/device information during deserialization.

None

Returns:

Name Type Description
DataTransformation DataTransformation

The deserialized transformation.