I need to Serialize\Deserialze between DataTable and json using json.net.
I found that json.net igrone the "TableName" Attribute.how can i add it?
code like this.
DataTable table = new DataTable();
table.TableName = "TestTable";
table.Columns.Add("id", typeof(int));
table.Columns.Add("name", typeof(string));
var dr = table.NewRow();
dr["id"] = 1;
dr["name"] = "foo";
table.Rows.Add(dr);
var json = JsonConvert.SerializeObject(table);
var o = JsonConvert.DeserializeObject<DataTable>(json);
when Serialize, got json [{"id":1,"name":"foo"}]. this json does not have TableName,and Deserialize it , the table also haven't TableName.
so,I need the TableName ,how can i hold it?