Utilize __toString method for object serialization if exists.