Skip to content

Instantly share code, notes, and snippets.

@crazed
Created December 28, 2015 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crazed/b5448baeb204eb816eb9 to your computer and use it in GitHub Desktop.
Save crazed/b5448baeb204eb816eb9 to your computer and use it in GitHub Desktop.
jq deep merge
➜ ~ cat a.json
{
"_meta": {
"tag_environment_magic": [
"a"
]
}
}
➜ ~ cat b.json
{
"_meta": {
"tag_environment_magic": [
"b"
]
}
}
➜ ~ jq -s 'reduce .[] as $x ({}; . * $x)' a.json b.json
{
"_meta": {
"tag_environment_magic": [
"b"
]
}
}
Expected:
{
"_meta": {
"tag_environment_magic": [
"a",
"b"
]
}
}
@eMPee584
Copy link

see https://stackoverflow.com/a/53666584/200509 for something that, in the end, kinda worked for me 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment