Created
December 28, 2015 18:32
-
-
Save crazed/b5448baeb204eb816eb9 to your computer and use it in GitHub Desktop.
jq deep merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
β ~ 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" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see https://stackoverflow.com/a/53666584/200509 for something that, in the end, kinda worked for me π