I am getting some JSON data from the NYTimes API. I can get things to this form:
"results": [
{
"headline": "such and such",
"url": "http://such.and.such.com",
...
},
{
"headline": "so and so",
"url": "http://so.and.so.com",
...
},
...
]
I want to echo 1 string for every object in the array, so that the string text displays the headline, and the string is clickable to the url.
I know how I want the string to be built:
echo -e "\e]8;;$URL\a$TITLE\e]8;;\a"
I can't figure out how to use jq to populate those variable portions of the string.
> echo $RESULTS | jq '.results[] | "\e]8;;\(.url)\a\(.title)\e]8;;\a"'
jq: error: Invalid escape at line 1, column 4 (while parsing '"\e"') at <top-level>, line 1:
.results[] | "\e]8;;\(.url)\a\(.title)\e]8;;\a"
jq: error: Invalid escape at line 1, column 4 (while parsing '"\a"') at <top-level>, line 1:
.results[] | "\e]8;;\(.url)\a\(.title)\e]8;;\a"
jq: error: Invalid escape at line 1, column 4 (while parsing '"\e"') at <top-level>, line 1:
.results[] | "\e]8;;\(.url)\a\(.title)\e]8;;\a"
jq: error: Invalid escape at line 1, column 4 (while parsing '"\a"') at <top-level>, line 1:
.results[] | "\e]8;;\(.url)\a\(.title)\e]8;;\a"
jq: 4 compile errors