use generic method to stringify object