title: convert mvc c# model class to json from datatable
body: <p>I have a C# class and data table.</p>
  
  <p>DataTable:</p>
  
  <pre><code>+---------+-----------------+---------------+---------+---------+--------------+
  | Pers_Id | Pers_First_Name | Pers_Last_Name| OrderNu | OrderId |  Pers_Update |
  +---------+-----------------+---------------+---------+---------+--------------+
  | 1       |       ABC       |        Ln     |   76454 |  1      |   2018-03-25 |
  +---------+-----------------+---------------+---------+---------+--------------+
  | 1       |       ABC       |        Ln     |   76578 |  2      |   2018-03-25 |
  +---------+-----------------+---------------+---------+---------+--------------+
  </code></pre>
  
  <p>Class:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class Person
  {
      public int Pers_Id { get; set; }
      public string Pers_First_Name { get; set; }
      public string Pers_Last_Name { get; set; }
      public DateTime Pers_Update { get; set; }
      public List&lt;Order&gt; Order_List { get; set; }
  
      public class Order
      {
          public int OrderID { get; set; }
          public string OrderNu { get; set; }
      }
  }
  </code></pre>
  
  <p>I need to bind this class from data table and need to convert it into json object for rest API response in asp .net web API.</p>
  
  <p>When i am binding i am getting json duplicate but result should be like this </p>
  
  <p>{
    "Pers_Id": 1,
    "Pers_First_Name": "ABC",
    "Pers_Last_Name": "LN",
    "Pers_Update": "",
    "Order_List": [
      {
        "OrderID": "1",
        "OrderNu": "76454"
      },
      {
        "OrderID": "2",
        "OrderNu": "76578"
      }
    ]
  }</p>