0

passing bash variable to jq for generate json from template

pacman created at7 months ago view count: 74

template file /tmp/template.json

{"foo": $ foo, "bar": $bar}

passing bash variable

jq -n --arg foo "is foo" --arg bar "bar value" -f /tmp/template.json 

result

{
  "foo": "is foo",
  "bar": "bar value"
}


report

Comments

search keywords