2

我正在使用 Json.Net 将 DataTable 转换为 JSON,如下所述,但我的 JSON 字符串\在引号之前包含反斜杠字符。如何删除这些字符?

将 DataTable 转换为 JSON 字符串的 C# 代码:

string json = JsonConvert.SerializeObject(objAcctDTable, Formatting.None);

Json 输出字符串:

"[{\"AcctID\":5822,\"AcctName\":\"1 EDI SOURCE INC (Vendor)\"},{\"AcctID\":4350,\"AcctName\":\"21C OATS, INC. (Rail Customer)\"},{\"AcctID\":5729,\"AcctName\":\"24 Waterway LLC (Leasing Company Account)\"},{\"AcctID\":3799,\"AcctName\":\"3D CORPORATE SOLUTIONS LLC (Rail Customer)\"},{\"AcctID\":4596,\"AcctName\":\"3FNP (HINES 70 WEST MADISON LP) (Vendor)\"},{\"AcctID\":6035,\"AcctName\":\"3FNP LLC (Oracle Vendor)\"},{\"AcctID\":4622,\"AcctName\":\"3M CO (Vendor)\"},{\"AcctID\":4532,\"AcctName\":\"3M COMPANY (Oracle Customer)\"},{\"AcctID\":5912,\"AcctName\":\"5th3rd, BCC (Leasing Company Account)\"},{\"AcctID\":5913,\"AcctName\":\"5th3rd, UBOC, FNBC (Leasing Company Account)\"},{\"AcctID\":5730,\"AcctName\":\"8121 Broadway Interests, LLC (Leasing Company Account)\"},{\"AcctID\":3324,\"AcctName\":\"A E STALEY MFG. (Mileage Tax Customer)\"}]"
4

0 回答 0