transform the object into a hash