Just started out with Bash scripting and stumbled upon jq to work with JSON.
I need to transform a JSON string like below to a table for output in the terminal.
If the values don't contain spaces, this might be helpful:
read -r -a data <<<'name1 value1 name2 value2' echo "name value" echo "==========" for ((i=0; i<${#data[@]}; i+=2)); do echo ${data[$i]} ${data[$((i+1))]} done
Output
name value ========== name1 value1 name2 value2