extract function for flattening lists of maps