Skip to main content

deserialize

Deserialize a stream or a string. Return an iterator that yields (obj, m2m_relation_dict), where obj is an instantiated -- but unsaved -- object, and m2m_relation_dict is a dictionary of {m2m_field_name : list_of_related_objects}.

def deserialize(
format: string,
stream_or_string: string|file-like object,
**options: dict
) - > iterator

Deserialize a stream or a string. Return an iterator that yields (obj, m2m_relation_dict), where obj is an instantiated -- but unsaved -- object, and m2m_relation_dict is a dictionary of {m2m_field_name : list_of_related_objects}.

Parameters

NameTypeDescription
formatstringThe serialization format identifier (e.g., 'json', 'xml') used to select the appropriate deserializer engine
stream_or_string`stringfile-like object`
**optionsdictAdditional format-specific keyword arguments passed to the underlying deserializer engine

Returns

TypeDescription
iteratorAn iterator yielding tuples of (unsaved_object, m2m_relation_dictionary) for each record in the source