I have been trying to reduce the array to a string to be used in string interpolation.
For example.
input = ["123", "456"]
expected output = array=123,456
Here is my try
$ echo '["123", "456"]' | jq 'array=\(.|join(","))'
jq: error: syntax error, unexpected INVALID_CHARACTER (Unix shell quoting issues?) at <top-level>, line 1:
array=\(.|join(","))
jq: 1 compile error
with jtc:
bash $ echo '["123", "456"]' | jtc -qqT'"array={}"'
array=123, 456
bash $ If the spacer after comma (, ) is redundant, then alter the namespace $# holding a default separator (which is ", ")
for array stringification:
bash $ echo '["123", "456"]' | jtc -w'<$#:,>v' -qqT'"array={}"'
array=123,456
bash $