I have a JSON file and a text file as shown below :
{
symbols: null,
symbols_count : null
}
values.txt
VALUE1
VALUE2
VALUE3
Using jq, I want to add values of values.txt as an array to the symbols field of the json.
symbols_count=$(wc -l < values.txt)
jq ".symbol_count = $symbols_count" < input.json | \
jq --slurpfile symbols values.txt '.symbols_count=$symbols'
The last jq command fails because the values in values.txt are not enclosed by "" .
Is there any way to add double quotes without changing values.txt?