flattening the object to an array.