serialize writable object.