'Returns a dictionary of the attributes of this object,
containing only "JSON types" (string, number, boolean,
none, dict, list).
References to other objects are serialized as "refs" (just
the object ID and type info), so the deserializer will
need to separately have the full attributes of those
other objects.
There\'s no corresponding from_json() because to
deserialize an object is normally done in the context of a
Document (since the Document can resolve references).
For most purposes it\'s best to serialize and deserialize
entire documents.
Args:
include_defaults (bool) : whether to include attributes
that haven\'t been changed from the default'

def to_json(self, include_defaults):

    return loads(self.to_json_string(include_defaults=include_defaults))
