title: Reading Large JSON file into variable in C#.net
body: <p>I am trying to parse the JSON files and insert into the SQL DB.My parser worked perfectly fine as long as the files are small (less than 5 MB).</p>
  
  <p>I am getting "Out of memory exception" when trying to read the large(> 5MB) files.</p>
  
  <pre><code>if (System.IO.Directory.Exists(jsonFilePath))
                  {
                      string[] files = System.IO.Directory.GetFiles(jsonFilePath);
                      foreach (string s in files)
                      {
                          var jsonString = File.ReadAllText(s);
                          fileName = System.IO.Path.GetFileName(s);
                          ParseJSON(jsonString, fileName);
  
                      }
                  }
  </code></pre>
  
  <p>I tried the JSONReader approach, but no luck on getting the entire JSON into string or variable.Please advise.</p>