title: Merge/Concatenate multiple json files using PowerShell
body: <p>I have multiple .json files that I would like to concatenate or append to each other using PowerShell. Where one will end, I would like the next to continue. To keep it simple, I'm just going to show an example of two files that I would like to merge. </p>
  
  <p><strong>File1.json</strong></p>
  
  <pre><code>[
      {
          "ItemID":  10746,
          "CompanyID":  3694,
          "Company":  "Sweet Mamma",
          "SRP":  0.0001,
          "UPC":  "9076625"
      },
      {
          "ItemID":  10761,
          "CompanyID":  3694,
          "Company":  "Sweet Mamma",
          "UPC":  "6128021"
      } ]
  </code></pre>
  
  <p><strong>File2.json</strong></p>
  
  <pre><code>[
      {
          "ItemID":  477761,
          "CompanyID":  4398,
          "Company":  "Moonlight",
          "UPC":  "4000308"
      },
      {
          "ItemID":  477761,
          "CompanyID":  4398,
          "Company":  "Moonlight",
          "SRP":  14.6500,
          "UPC":  "099904000308"
      }
  ]
  </code></pre>
  
  <p>I know that I can use the below syntax in Powershell to concatenate the two json files.</p>
  
  <p>Get-Content "C:\File1.json","C:\File2.json" | Set-Content "C:\CombinedOutput.json"</p>
  
  <p>However, when I execute this script, I nearly get what I need, except the beginning and ending brackets are left (where one json file ends and the next begins). These two brackets as shown in the example below in the middle, which should be removed and replaced with a comma as shown in the above example. </p>
  
  <p>Note: I was unable to bold so I am drawing attention to them by surrounding with asterisks.</p>
  
  <pre><code>[
      {
          "ItemID":  10746,
          "CompanyID":  3694,
          "Company":  "Sweet Mamma",
          "SRP":  0.0001,
          "UPC":  "9076625"
      },
      {
          "ItemID":  10761,
          "CompanyID":  3694,
          "Company":  "Sweet Mamma",
          "UPC":  "6128021"
      }
  **]**
  **[**
      {
          "ItemID":  477761,
          "CompanyID":  4398,
          "Company":  "Moonlight",
          "UPC":  "4000308"
      },
      {
          "ItemID":  477761,
          "CompanyID":  4398,
          "Company":  "Moonlight",
          "SRP":  14.6500,
          "UPC":  "099904000308"
      }
  ]
  </code></pre>
  
  <p>To reiterate, these brackets...</p>
  
  <pre><code>]
  [
  </code></pre>
  
  <p>...should be replaced with a comma.</p>
  
  <pre><code>,
  </code></pre>
  
  <p>The desired output file would then look like the below and even merging several json files into one would still allow it to properly flow like one continuous json file.</p>
  
  <pre><code>[
      {
          "ItemID":  10746,
          "CompanyID":  3694,
          "Company":  "Sweet Mamma",
          "SRP":  0.0001,
          "UPC":  "9076625"
      },
      {
          "ItemID":  10761,
          "CompanyID":  3694,
          "Company":  "Sweet Mamma",
          "UPC":  "6128021"
      },
      {
          "ItemID":  477761,
          "CompanyID":  4398,
          "Company":  "Moonlight",
          "UPC":  "4000308"
      },
      {
          "ItemID":  477761,
          "CompanyID":  4398,
          "Company":  "Moonlight",
          "SRP":  14.6500,
          "UPC":  "099904000308"
      }
  ]
  </code></pre>