Serialization
- braket.jobs.serialization.serialize_values(data_dictionary, data_format)[source]
Serializes the
data_dictionaryvalues to the format specified bydata_format.- Parameters:
data_dictionary (
dict[str,Any]) – Dict whose values are to be serialized.data_format (
PersistedJobDataFormat) – The data format used to serialize the values. Note that forPICKLEDdata formats, the values are base64 encoded after serialization, so that they represent valid UTF-8 text and are compatible withPersistedJobData.json().
- Return type:
dict[str,Any]- Returns:
dict[str, Any] – Dict with same keys as
data_dictionaryand values serialized to the specifieddata_format.
- braket.jobs.serialization.deserialize_values(data_dictionary, data_format, allow_pickle=False)[source]
Deserializes the
data_dictionaryvalues from the format specified bydata_format.- Parameters:
data_dictionary (
dict[str,Any]) – Dict whose values are to be deserialized.data_format (
PersistedJobDataFormat) – The data format that thedata_dictionaryvalues are currently serialized with.allow_pickle (
bool) – Whether to allow deserialization of pickled data. Pickle deserialization can execute arbitrary code and is unsafe on untrusted data. Default: False.
- Return type:
dict[str,Any]- Returns:
dict[str, Any] – Dict with same keys as
data_dictionaryand values deserialized from the specifieddata_formatto plaintext.- Raises:
RuntimeError – If data format is PICKLED_V4 and allow_pickle is False.