title: Using System.Text.Json to deserialize nested array of array json object
body: <p>I would like to deserialize <a href="https://raw.githubusercontent.com/ngabovictor/Rwanda/master/data.json" rel="nofollow noreferrer">this json file</a>. The json file has the following pattern that repeats itself:</p>
  <pre><code>{
      &quot;Province&quot;: {
          &quot;District&quot;: {
              &quot;Sector&quot;: {
                  &quot;Cell&quot;: [
                      &quot;Village1&quot;,
                      &quot;Village2&quot;,
                      &quot;Village3&quot;,
                      &quot;Village4&quot;
                  ]
              }
          }
      }
  }
  </code></pre>
  <p>I am using the following code to read and deserialized the json</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Text.Json;
  
  class Program
  {
      public class Province {
          public string Name { get; set; }
          public ICollection&lt;District&gt; Districts { get; set; }
      }
      public  class District {
          public string Name { get; set; }
          public ICollection&lt;Sector&gt; Sectors { get; set; }
  
      }
      public class Sector {
          public string Name { get; set; }
          public ICollection&lt;Cell&gt; Cells { get; set; }
      }
      public class Cell {
          public string Name { get; set; }
          public ICollection&lt;Village&gt; Villages { get; set; }
      }
      public class Village {
          public string Name { get; set; }
      }
      static void Main(string[] args) {
          string json = DownloadJsonData();
          var provinces = JsonSerializer.Deserialize&lt;List&lt;Province&gt;&gt;(json);
      Console.WriteLine(provinces[0].Name);
      }
      private static string DownloadJsonData() {
          using var webClient = new System.Net.WebClient();
          string result = webClient.DownloadString(&quot;https://raw.githubusercontent.com/ngabovictor/Rwanda/master/data.json&quot;);
          return result;
      }
     
  }
  </code></pre>
  <p>The above code results in the following exception</p>
  <p><em>HResult=0x80131500
  Message=The JSON value could not be converted to System.Collections.Generic.List`1[Program+Province]. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
  Source=System.Text.Json</em></p>
  <p>What I am doing wrong?</p>