convert an object to array