I am going accept the answer from @EdMorton as best here, the main reason is that it allows me to:
deserial() {
declare function_to_call="$1"
declare -n assoc_array_ref="$2"
while IFS= read -r -d '' line; do
assoc_array_ref+=( $line )
done < <($function_to_call)
}
and then simply call deserial func Y
- this populates the associative array Y with what was returned from function func
universally.