title: C# DataTable to Json?
body: <p>I want to get DataTable as Json Format to show it on a chart.</p>
  
  <pre><code>public JsonResult GetDataTable()
  {
      DataTable dt = new DataTable();
  
      dt.Columns.Add("Jan");
      dt.Columns.Add("Feb");
      dt.Columns.Add("Mar");
      dt.Columns.Add("Apr");
  
      for (int i = 0; i &lt; 10; i++)
      {
          dt.Rows.Add(i * 5, i * 10, i * 15, i * 11);
      }
  
      // JsonDataTable = dt to Json
  
      return new JsonResult
      {
          Data = new
          {
              success = true,
                  chartData = JsonDataTable 
          },
          JsonRequestBehavior = JsonRequestBehavior.AllowGet
      };
  }
  </code></pre>
  
  <p>How Can I convert DataTable to Json?</p>
  
  <p>Thanks.</p>