I've got 2 json files and want to merge them into one file. Here the content of files:
a.json:
{
    "config":
    {
        "config1":
        {
            "config11":
            {
                "apple":"apple",
                "orange":"orange",
                "lemon":[
                    "lemon1",
                    "lemon2",
                    "lemon3"
                ],
                "pear":"pear"
            }
        },
        "config2":
        {
            "config21":"hello",
            "config22":"goodbye"
        }
    }
}
b.json:
{
    "config":
    {
        "config1":
        {
            "config11":
            {
                "apple":null,
                "orange":null,
                "lemon":[
                    "lemon4",
                    "lemon5",
                    "lemon6"
                ],
                "pear":null
            }
        },
        "config2":
        {
            "config21":"hey",
            "config22":null
        }
    }
}
I want to merge the not-null part of b.json into a.json
Expected result:
{
    "config":
    {
        "config1":
        {
            "config11":
            {
                "apple":"apple",
                "orange":"orange",
                "lemon":[
                    "lemon4",
                    "lemon5",
                    "lemon6"
                ],
                "pear":"pear"
            }
        },
        "config2":
        {
            "config21":"hey",
            "config22":"goodbye"
        }
    }
}
I try this command:
jq -s '.[0] + .[1]' a.json b.json
but the output is not i want
i read https://stedolan.github.io/jq/manual ,but i still don't know how to do
Any helps?Thank you.
append:
aa.json
{
  "config": {
    "config_again": {
      "country": {
        "countrylist": [
          "CANADA",
          "MEXICO",
          "USA"
        ]
      },
      "language": {
        "languageorderlist": [
          "en_US",
          "hu_HU",
          "in_ID",
          "it_IT",
          "iw_IL",
          "zh_CN"
        ]
      },
      "video": {
        "mp4": "1",
        "mkv": "1"
      },
      "Audio": {
        "audio_audio": "0x111111"
      }
    }
  }
}
bb.json:
{
  "config": {
    "config_again": {
      "country": {
        "countrylist": [
          "USA"
        ]
      },
      "language": {
        "languageorderlist": [
          "en_US",
          "de_DE"
        ]
      },
      "video": {
        "mp4": null,
        "mkv": null
      },
      "Audio": {
        "audio_audio": "0x666666"
      }
    }
  }
}
 
    