I am reading an array from a file
file.json
{
"content": ["string with spaces", "another string with spaces", "yet another string with spaces"]
}
#!/bin/bash
GROUP_ID_TEMP=( $(IFS=','; jq -r '.content' file.json) )
why does jq read content print or echo content as space separated array for the below codeblock at the whitespace rather than the comma ',' as explicitly stated?
for each in "${GROUP_ID_TEMP[@]}"
do
echo "$each" >> "file.txt"
done
jq -r '.content' file.json2)IFS=,;jq -r '.content' file.json3)echo $(IFS=','; jq -r '.content' file.json)... etc? Good luck.IFS=,to have an effect onjq ..? If yes, try removing the;, however I don't think that will solve your problem. Good luck.