Skip to content

Instantly share code, notes, and snippets.

@guillim
Forked from joar/jq-insert-var.sh
Created June 11, 2018 11:52
Show Gist options
  • Select an option

  • Save guillim/10f5f7b8aa05324ca0572d33506bd6ab to your computer and use it in GitHub Desktop.

Select an option

Save guillim/10f5f7b8aa05324ca0572d33506bd6ab to your computer and use it in GitHub Desktop.
Add a field to an object with JQ
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment