transparentmeta.serialization package

Submodules

transparentmeta.serialization.metadata_serializer module

Provides the MetadataSerializer class for converting Metadata objects to and from JSON strings.

class transparentmeta.serialization.metadata_serializer.MetadataSerializer(indent=None)[source]

Bases: object

Handles serialization and deserialization of Metadata objects to and from JSON strings.

Parameters:

indent (Optional[int]) – Number of spaces to use for indentation in the JSON output. If None, the JSON will be compact (no pretty-printing).

__init__(indent=None)[source]
deserialize(json_str)[source]

Deserialize a JSON string back into a Metadata object.

Parameters:

json_str (str) – The JSON string to deserialize.

Returns:

A Metadata object created from the JSON

string.

Return type:

metadata_obj (Metadata)

serialize(metadata)[source]

Serialize the given Metadata object to a JSON string.

Parameters:

metadata (Metadata) – The metadata object to serialize.

Returns:

A JSON-formatted string representation of

the metadata.

Return type:

metadata_string (str)

Module contents