convert a object to array