as_dict#

String.as_dict(recursive=False) dict[str, Any]#

Serialize the model into a plain dictionary.

The resulting mapping contains dataclass fields plus any additional instance attributes (excluding private attributes and attributes with value None).

If recursive is True, list-valued attributes are converted into lists of GUIDs instead of lists of objects.

Parameters:
recursivebool, default: False

If True, recursively serialize lists of related objects as lists of GUIDs.

Returns:
dict of str to Any

Mapping of attribute name to value.