get field from json and assign to variable in bash script?

With that line of code

value=($(jq -r '.key1' jsonFile))

you are assigning both values to an array. Note the outer parantheses () around the command.
Thus you can access the values individually or echo the content of the entire array.

$ echo "${value[@]}"
aaaa bbbb

$ echo "${value[0]}"
aaaa

$ echo "${value[1]}"
bbbb

Since you echoed $value without specifying which value you want to get you only get the first value of the array.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)