title: Looping through JSON array's object
body: <p>I have a JSON string like below</p>
  
  <pre><code> {"data":[{"report_header":{"c1":{"name":"COLUMN1","type":"java.lang.String"},"c2":{"name":"COLUMN2","type":"java.lang.String"}},"report_row":[{"c1":"2019","c2":"TEST123"},{"c1":"2019","c2":"TEST345"},{"c1":"2020","c2":"TEST567"}]}],"message":["OK"],"status":200}
  </code></pre>
  
  <p>I have used json2csharp and created classes.</p>
  
  <pre><code>    public class C1
  {
      public string name { get; set; }
      public string type { get; set; }
  }
  
  public class C2
  {
      public string name { get; set; }
      public string type { get; set; }
  }
  
  public class ReportHeader
  {
      public C1 c1 { get; set; }
      public C2 c2 { get; set; }
  }
  
  public class ReportRow
  {
      public string c1 { get; set; }
      public string c2 { get; set; }
  }
  
  public class Datum
  {
      public ReportHeader report_header { get; set; }
      public List&lt;ReportRow&gt; report_row { get; set; }
  }
  
  public class RootObject
  {
      public List&lt;Datum&gt; data { get; set; }
      public List&lt;string&gt; message { get; set; }
      public int status { get; set; }
  }
  </code></pre>
  
  <p>And reading values using below code</p>
  
  <pre><code>var jss = new JavaScriptSerializer();
  var ListExample = jss.Deserialize&lt;RootObject&gt;(result);
  IList&lt;Datum&gt; listData = ListExample.data;
  IList&lt;ReportRow&gt; reportRows = listData[0].report_row;
  
  foreach (ReportRow row in reportRows)
                  {
  
                      Console.WriteLine(row.c1.ToString());
                      Console.WriteLine(row.c2.ToString());
  
                  }
  </code></pre>
  
  <p>My question is how I can modify above code to make it more generic so that in can handle more columns. Like what if I have more columns like c3,c4 in Jason. How can I iterate through them without re-writing Report Row class for all such use cases.</p>