add callback that is invoked before an object is written out

This can be used by applications to clean out or make invisible properties
that should not be serialized.
update version