title: Merge of two complicated JSON objects
body: <p>I want to merge two JSON objects into a new one. I try to use jsonmerge with a complete json schema, but i dont know how to set the merge strategies right. I am pretty sure it can be done.</p>
  
  <p>Code:</p>
  
  <pre><code>import json
  from jsonmerge import Merger
  from jsonschema import validate
  full_build = {
           "captures": [
              {
                 "compiler": "gnu",
                 "executable": "gcc",
                 "cmd": ["gcc", "options", "file1.cpp"],
                 "cwd": ".",
                 "env": ["A=1", "B=2"],
              },
              {
                 "compiler": "gnu",
                 "executable": "gcc",
                 "cmd": ["gcc", "options", "file2.cpp"],
                 "cwd": ".",
                 "env": ["A=1", "B=2"],
              }
           ]
  }
  incremental_build = {
           "captures": [
              {
                 "compiler": "gnu",
                 "executable": "gcc",
                 "cmd": ["gcc", "new options", "file2.cpp"],
                 "cwd": ".",
                 "env": ["A=1", "NEW=2"],
              },
              {
                 "compiler": "gnu",
                 "executable": "gcc",
                 "cmd": ["gcc", "options", "file3.cpp"],
                 "cwd": ".",
                 "env": ["A=1", "B=2"],
              }
           ]
  }
  schema = {
     "type" : "object",
     "properties" : {
        "captures": {
           "type" : "array",
           "items" : {
              "type" : "object",
              "properties" : {
                 "cmd" : {
                    "type" : "array",
                    "items" : {"type" : "string"},
                 },
                 "compiler" : {"type" : "string"},
                 "cwd" : {"type" : "string"},
                 "env" : {
                    "type" : "array",
                    "items" : {"type" : "string"},
                 },
                 "executable" : {"type" : "string"},
              }
           }
        }
     }
  }
  validate(instance=full_build, schema=schema)
  
  mergeSchema = schema
  merger = Merger(mergeSchema)
  result = merger.merge(full_build, incremental_build)
  print(json.dumps(result, indent=3))
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>{
     "captures": [
        {
           "compiler": "gnu",
           "executable": "gcc",
           "cmd": [
              "gcc",
              "options",
              "file3.cpp"
           ],
           "cwd": ".",
           "env": [
              "A=1",
              "B=2"
           ]
        }
     ]
  }
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>{
     "captures": [
        {
           "compiler": "gnu",
           "executable": "gcc",
           "cmd": [
              "gcc",
              "options",
              "file1.cpp"
           ],
           "cwd": ".",
           "env": [
              "A=1",
              "B=2"
           ]
        },
        {
           "compiler": "gnu",
           "executable": "gcc",
           "cmd": [
              "gcc",
              "new options",
              "file2.cpp"
           ],
           "cwd": ".",
           "env": [
              "A=1",
              "NEW=2"
           ]
        },
        {
           "compiler": "gnu",
           "executable": "gcc",
           "cmd": [
              "gcc",
              "options",
              "file3.cpp"
           ],
           "cwd": ".",
           "env": [
              "A=1",
              "B=2"
           ]
        }
     ]
  }
  </code></pre>
  
  <p>There are more things to consider (like having more or fewer options/environment variables then before), but I think with a little hint i will manage to complete the task.
  I really dont want to hard code it.</p>
  
  <p>And no, i cannot change the structure of the json :(.</p>
  
  <p>Background: I want to merge SonarQube build wrapper outputs, because i dont want to do a full build to get all files into the wrapper output.</p>