DataTable table = new DataTable();
table.Columns.Add("ID", typeof(string));
table.Columns.Add("Name", typeof(string));
for (int i = 0; i < 100; i++)
{
DataRow row = table.NewRow();
row["ID"] = i.ToString();
row["Name"] = "张三" + i.ToString();
table.Rows.Add(row);
}
dataGridView1.DataSource = table;
var json = JsonConvert.SerializeObject(table);