Similar to the solutions of @choroba and @ASarkar but modified to handle any special characters by shell-quoting expansion:
#!/bin/bash
function Dictionary_Builder() {
declare -A dict=(['title']="Title of the song"
['artist and "friends"']="Artist's song"
['album']="Album of the song"
)
echo '('
for key in "${!dict[@]}" ; do
echo "[${key@Q}]=${dict[$key]@Q}"
done
echo ')'
}
declare -A Output_Dictionary="$(Dictionary_Builder)"
for key in "${!Output_Dictionary[@]}" ; do
echo "${key}: '"${Output_Dictionary[$key]}"'"
done