title: How to update a subitem in a json file using jq?
body: <p>Using <code>jq</code> I tried to update this json document:</p>
  
  <pre><code>{
  "git_defaults": {
      "branch": "master",
      "email": "jenkins@host",
      "user": "Jenkins"
  },
  "git_namespaces": [
  {
      "name": "NamespaceX",
          "modules": [
              "moduleA",
              "moduleB",
              "moduleC",
              "moduleD"
          ]
  },
  {
      "name": "NamespaceY",
      "modules": [
          "moduleE"
      ]
  }
  ]
  }
  </code></pre>
  
  <p>with adding <code>moduleF</code> to <code>NamespaceY</code>. I need to write the file back again to the original source file. </p>
  
  <p>I came close (but no cigar) with:</p>
  
  <pre><code>jq  '. | .git_namespaces[] | select(.name=="namespaceY").modules |= (.+ ["moduleF"])' config.json
  </code></pre>
  
  <p>and </p>
  
  <pre><code>jq '. | select(.git_namespaces[].name=="namespaceY").modules |= (.+ ["moduleF"])' config.json
  </code></pre>