When I do this:
arr=($(echo '{"crew":[{"name":"kirk"},{"name":"bones"},{"name":"mr spock"}]}' | jq -r '.crew[].name | @sh'))
I get:
echo "${arr[2]}"
mr
echo "${arr[3]}"
spock
However when I do this:
arr=("kirk" "bones" "mr spock")
I get this:
echo "${arr[2]}"
mr spock
Why, in the first example, is bash ignoring the quotes that each jq value is wrapped in when it creates the array?