I have a bash array
X=(\"hello world\" \"goodnight moon\")
That I want to turn into a json array
[\"hello world\", \"goodni
You can use:
X=("hello world" "goodnight moon") sed 's/^/[/; s/,$/]/' <(printf '"%s",' "${X[@]}") | jq -s '.' [ [ "hello world", "goodnight moon" ] ]