detect optional keys in arrays