serialize

negmas.serialization.serialize(value, deep=True, add_type_field=True, keep_private=False, ignore_methods=True, ignore_lambda=False, objmem=None)[source]

Encodes the given value as nothing more complex than simple dict of either dicts, lists or builtin numeric or string values. The resulting dictionary will be json serializable

Parameters
  • value – Any object

  • deep – Whether we should go deep in the encoding or do a shallow encoding

  • add_type_field – Whether to add a type field. If True, A field named PYTHON_CLASS_IDENTIFIER will be added

  • the type of value (giving) –

  • keep_private – Keeps fields starting with “_”

Remarks:

  • All iterables are converted to lists when deep is true.

  • If the value object has a to_dict member, it will be called to do the conversion, otherwise its __dict__ or __slots__ member will be used.

See also

deserialize, PYTHON_CLASS_IDENTIFIER