Flatten array with key.