i have this two json files: ubuntubionic.json:
{
"ubuntu": {
"os_ver": "bionic",
"image": "abcdef",
"image_tag": "3.33.3",
"docker_compiler_image": "abc",
"image_compiler_tag": "4.44.4"
}
}
and ubuntufocal.json:
cat ubuntubionic.json
{
"ubuntu": {
"os_ver": "focal",
"image": "xxxx",
"image_tag": "3.33.3",
"docker_compiler_image": "xxxx",
"image_compiler_tag": "4.44.4"
}
}`
i want to merge these two files into 1 file to get output that looks like this:
{
"ubuntu": {
"os_ver": "focal",
"image": "abcdef",
"image_tag": "3.33.3",
"docker_compiler_image": "abc",
"image_compiler_tag": "4.44.4"
},
"os_ver": "bionic",
"image": "xxxx",
"image_tag": "3.33.3",
"docker_compiler_image": "xxxx",
"image_compiler_tag": "4.44.4"
}
i tried jq -s add ubuntufocal.json ubuntubionic.json > all_os.json but i'm getting that bionic is overwriting focal
cat all_os.json
{
"ubuntu": {
"os_ver": "bionic",
"image": "xxxx",
"image_tag": "3.33.3",
"docker_compiler_image": "xxxx",
"image_compiler_tag": "4.44.4"
}
}
how can this be solved? got totally lost in the JQ man page