title: Merging Multiple JSON Files into Single File
body: <p>I am reading Multiple JSON Files as such:</p>
  
  <pre><code>using (var fbd = new FolderBrowserDialog())
  {
      DialogResult result = fbd.ShowDialog();
  
      if (result == System.Windows.Forms.DialogResult.OK &amp;&amp; !string.IsNullOrWhiteSpace(fbd.SelectedPath))
      {
          IEnumerable&lt;string&gt; allJSONFiles = GetFileList("*.json", fbd.SelectedPath);
          txtOutput.Clear();
          txtOutput.Text = "Number of files found: " + allJSONFiles.ToList().Count + "\n";
          foreach (string filename in allJSONFiles)
          {
              txtOutput.Text += filename + "\n";
          }                   
      }
  }
  </code></pre>
  
  <p>Now the JSON files more or less look like this, with multiple objects:</p>
  
  <pre><code>[{
          "Domain": "example.com",
          "A": ["50.63.202.28"],
          "MX": ["0 example-com.mail.protection.outlook.com."],
          "NS": ["ns48.example.com.", "ns47.example.com."],
          "SOA": ["ns47.example.com. dns.jomax.net. 2017062304 28800 7200 604800 600"],
          "TXT": ["\"MS=ms94763887\"", "\"google-site-verification=example-f0KFEgl-HnJF4_Gk\"", "\"v=spf1 include:spf.protection.outlook.com -all\""],
          "Country": ["United States"],
          "Hostname": ["'ip-50-63-202-28.ip.secureserver.net'"],
          "SSL": ["None"],
          "WHOIS": [1096],
          "TTL": ["568"]
      }, {
          "Domain": "example.org",
          "A": ["50.63.202.59"],
          "MX": ["30 ALT2.ASPMX.L.GOOGLE.COM.", "20 ALT1.ASPMX.L.GOOGLE.COM.", "50 ASPMX3.GOOGLEMAIL.COM.", "10 ASPMX.L.GOOGLE.COM.", "40 ASPMX2.GOOGLEMAIL.COM."],
          "NS": ["ns13.example.com.", "ns14.example.com."],
          "SOA": ["ns13.example.com. dns.jomax.net. 2016081700 28800 7200 604800 600"],
          "Country": ["United States"],
          "Hostname": ["'ip-50-63-202-59.ip.secureserver.net'"],
          "SSL": ["None"],
          "WHOIS": [5844],
          "TTL": ["569"]
      }
  ]
  </code></pre>
  
  <p>All I want to do is to join these objects from the multiple files I am reading to create a single file as output. So assuming that there were 2 exactly same files as stated above, my output file would contain:</p>
  
  <pre><code>[{
          "Domain": "example.com",
          "A": ["50.63.202.28"],
          "MX": ["0 example-com.mail.protection.outlook.com."],
          "NS": ["ns48.example.com.", "ns47.example.com."],
          "SOA": ["ns47.example.com. dns.jomax.net. 2017062304 28800 7200 604800 600"],
          "TXT": ["\"MS=ms94763887\"", "\"google-site-verification=example-f0KFEgl-HnJF4_Gk\"", "\"v=spf1 include:spf.protection.outlook.com -all\""],
          "Country": ["United States"],
          "Hostname": ["'ip-50-63-202-28.ip.secureserver.net'"],
          "SSL": ["None"],
          "WHOIS": [1096],
          "TTL": ["568"]
      }, {
          "Domain": "example.org",
          "A": ["50.63.202.59"],
          "MX": ["30 ALT2.ASPMX.L.GOOGLE.COM.", "20 ALT1.ASPMX.L.GOOGLE.COM.", "50 ASPMX3.GOOGLEMAIL.COM.", "10 ASPMX.L.GOOGLE.COM.", "40 ASPMX2.GOOGLEMAIL.COM."],
          "NS": ["ns13.example.com.", "ns14.example.com."],
          "SOA": ["ns13.example.com. dns.jomax.net. 2016081700 28800 7200 604800 600"],
          "Country": ["United States"],
          "Hostname": ["'ip-50-63-202-59.ip.secureserver.net'"],
          "SSL": ["None"],
          "WHOIS": [5844],
          "TTL": ["569"]
      }, {
          "Domain": "example.com",
          "A": ["50.63.202.28"],
          "MX": ["0 example-com.mail.protection.outlook.com."],
          "NS": ["ns48.example.com.", "ns47.example.com."],
          "SOA": ["ns47.example.com. dns.jomax.net. 2017062304 28800 7200 604800 600"],
          "TXT": ["\"MS=ms94763887\"", "\"google-site-verification=example-f0KFEgl-HnJF4_Gk\"", "\"v=spf1 include:spf.protection.outlook.com -all\""],
          "Country": ["United States"],
          "Hostname": ["'ip-50-63-202-28.ip.secureserver.net'"],
          "SSL": ["None"],
          "WHOIS": [1096],
          "TTL": ["568"]
      }, {
          "Domain": "example.org",
          "A": ["50.63.202.59"],
          "MX": ["30 ALT2.ASPMX.L.GOOGLE.COM.", "20 ALT1.ASPMX.L.GOOGLE.COM.", "50 ASPMX3.GOOGLEMAIL.COM.", "10 ASPMX.L.GOOGLE.COM.", "40 ASPMX2.GOOGLEMAIL.COM."],
          "NS": ["ns13.example.com.", "ns14.example.com."],
          "SOA": ["ns13.example.com. dns.jomax.net. 2016081700 28800 7200 604800 600"],
          "Country": ["United States"],
          "Hostname": ["'ip-50-63-202-59.ip.secureserver.net'"],
          "SSL": ["None"],
          "WHOIS": [5844],
          "TTL": ["569"]
      }
  ]
  </code></pre>
  
  <p>How do I achieve this without serializing (as the objects vary significantly and I want to retain the format somewhat) and merging? I tried <a href="https://www.newtonsoft.com/json/help/html/MergeJson.htm" rel="nofollow noreferrer">NewtonSoft's merge</a>, but it seems too complicated for such simple operation. Is string manipulation my last option (somehow that doesn't feel correct, hence this question)? </p>
  
  <p><strong>Note:</strong> While the example just shows 2 files, I will be merging atleast 100 files in a go.</p>