title: How do I add dynamically generated arrays with jq?
body: <p>I'm using jq 1.6 on Windows 7 and want to add a dynamically generated array to a json file.
  That array doesn't yet exist in this file.</p>
  
  <p>I've got the following JSON structure (reduced for reasons of clarity):</p>
  
  <pre><code>{
    "policies": {
      "SearchBar": "separate",
      "SearchEngines": {
        "PreventInstalls": false
      }
    }
  }
  </code></pre>
  
  <p>I'd like to generate an array based on dynamic values and finally create the following output:</p>
  
  <pre><code>{
    "policies": {
      "SearchBar": "separate",
      "SearchEngines": {
        "PreventInstalls": false,
        "Remove": [
          "Twitter",
          "Wikipedia (en)"
        ]
      }
    }
  }
  </code></pre>
  
  <p>The Remove array's content is stored in a (cmd) %variable%.
  I found that the line</p>
  
  <pre><code>jq -n --arg items "%variable%" "{ Remove: $items | split(\",\") }"
  </code></pre>
  
  <p>produces the array I want:</p>
  
  <pre><code>{
    "Remove": [
      "Twitter",
      "Wikipedia (en)"
    ]
  }
  </code></pre>
  
  <p>What is the best way to insert this array into the original file?</p>