我尝试将数据集序列化为 json。一切正常,但如果没有记录,则缺少列信息。我找到了一些解决方案,但没有一个不能解决我的问题。
我编写了一个存储过程来从 MSSQL 服务器检索所有表记录并将其存储到数据集中,然后尝试使用 NewtonSoft 序列化为 json,然后将其写入 Json 文件。
DataSet ds_v
string json = JsonConvert.SerializeObject(ds_v);
System.IO.File.WriteAllText(Server.MapPath("~") + "/txt.json", json);
我想要如下的输出
{
"Table": [],//here iam getting empty table without having column informations.So i want to get the column informations
"Table1": [
{
}]
}
守着星空守着你
相关分类