Sample json file payload.json.tpl:
{
"foo": "bar",
"x": {
"y": "${array}"
}
}
I have an array in bash
array=("one" "two" "three")
How can I run the jq command to replace the key .x.y to ["one", "two", "three"]
So the final json will be:
{
"foo": "bar",
"x": {
"y": ["one", "two", "three"]
}
}