title: Parsing large json
body: <p>I'm trying to parse a json file and then operate on it to insert data into a SQL Server 2008 Database.</p>
  
  <p>Example:</p>
  
  <pre><code>var sr = new StreamReader("C:\\path to file\file.json");
  var json = JsonSerializer.SerializeToString(sr);
  var o = JsonObject.Parse(json);
  </code></pre>
  
  <p>But I always get this error at the second line - "Timeouts are not supported on this stream."</p>
  
  <p>The Json file looks like this:</p>
  
  <pre><code>"main":{
      "prg": [
                 {
                     "Id": 1,
                     "name": "A&amp;E",
                     more fields
                 }
      "prg": [
                 {
                     "Id": 2,
                     "name": "asda",
                     more fields
                 }
   }
  </code></pre>
  
  <p>I need to make something like this </p>
  
  <pre><code>foreach (prg in main)
      entity.id = prg.id
      entity.name = prg.name
  </code></pre>
  
  <p>How can I do this and why I get that timeout exception?</p>
  
  <p><strong>EDIT:</strong> To better understand my question this is how I do for an XML file</p>
  
  <pre><code>XmlDocument sourceDoc = new XmlDocument();
  sourceDoc.Load(SourcesElement2); // where SourcesElement2 is the path to my XML
  XmlNodeList prg = sourceDoc.GetElementsByTagName("prg");
  
  foreach (XmlNode item in prg)
  {
      entity.Name= item.SelectSingleNode("name").InnerText;
      ...
  }
  </code></pre>
  
  <p>I have converted the XML to Json and I want to do same thing. For every "prg" node in the Json File insert a new item in the database</p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>This is what I've done.</p>
  
  <pre><code>    using (
              StreamReader stream =
                  File.OpenText(
                      "C:\\path\\Sources.json")
              )
          {
              JObject sources = (JObject) JToken.ReadFrom(new JsonTextReader(stream));
  
              var a = sources["on"];
              var b = a["sources"];
              var c = b["prgs"];
              foreach (var item in c)
              {
                  var d= item.SelectToken("prg");
  
                  // Here d is null
  
              }
  </code></pre>
  
  <p>I have the same question as the one from above. For every "prg" node in the Json File insert a new item in the database. How can I do this ?   ( path to prg is  on/sources/prgs/ )</p>