C# Newtonsoft.Json.JsonReaderException:“Could not convert string to decimal:
2021-01-24 02:14
标签:方案 str move regex 替换 instr read nbsp ima 使用Newtonsoft.Json,报以上错误,问题的原因是有"",把“”替换成null: 以前的json: 解决方案: 处理后的json: C# Newtonsoft.Json.JsonReaderException:“Could not convert string to decimal: 标签:方案 str move regex 替换 instr read nbsp ima 原文地址:https://www.cnblogs.com/sunliyuan/p/12058527.html[{"WengvNj":"df5c38c6dd1744c59605da1fc85a0500","WengvSgtm":"2019-12-16 修理合同","WengvSu":"2019TJR001LX","WengvYewm":"修理","WengvXzhbdc":"1","WengvSuam":"","WengvXonvmkeq":"2019/12/16 0:00:00","WengvKosqjvp":"GK","WengvHapl":"SVH30","WengvWgaqoijz":"Y","WengvWgaqoiyags":"OK,同意!","WengvWgaqoixma":"wecrew","WengvWgaqoiomgs":"2019/12/16 10:20:10","WengvUrhvmkeqfhphk":"2019/12/16 0:00:00","WengvFyrbjuppnht":"2020/2/13 0:00:00","WengvWkhtrdjpnhtikskn":"2019/12/16 0:00:00","WengvWkhtrdjfnyttrlx":"","WengvJslz":"0","WengvYxhvbzzdg":"1","WengvUgfunxeoba":"","WengvUgfunxeyrh":"0","WengvUgfunxeegoikj":"","WengvJdjpjxrq":"","WengvHayznxnk":"CNY","WengvUgfunxeeha":"","WengvXat":"4400","WengvFmlvli":"LMF","WengvYxhlndjbr":"EXW","WengvXvlkrkwzbht":"","WengvHxlicoxma":"wecrew","WengvHxlicoomgs":"2019/12/16 10:19:46","WengvQgzbmkeq":"","WengvAgsqm":"","WengvTxkmanlfr":"","WengvFoyuxnp":"","WengvGafma":"","WengvGafmazsaas":"","WengvGafmaoxmvz":"","WengvAkulxb":"","WengvAkulxbtzicxsvswx":"","WengvAkulxbdtvdptu":"","WengvAkulxblpq":"","WengvAkulxbwuaybqe":"","WengvAkulxbwuayexffx":"","WengvAkulxbwuaytcrae":"","WengvGafmavtzxapd":"","WengvGafmavtzxdweew":"","WengvGafmavtzxsbqzd":"","WengvGafmamzzswgc":"","WengvGafmakabeckui":"","WengvGafmamzzswgcusmy":"","WengvAkulxbnaatxhd":"","WengvAkulxbdutbieiq":"","WengvAkulxbnaatxhdvtnz":"","WengvHuubaknfgmeu":"","WengvXkulyoamvfptu":"","WengvXkulyoamvfayec":"","WengvXkulyoamvfayecibjjb":"","WengvWkwirbxmaost":"","WengvWkwirbxmazxdb":"","WengvWkwirbxmazxdbhaiia":"","WengvXkulyoamvfhyxfmimu":"","WengvXkulyoamvfhyxfmimuayse":"","WengvWkwirbdutbieiq":"","WengvWkwirbdutbieiqwuoa":""}]
public string RemoveJsonFieldIsNull(string str)
{
if (string.IsNullOrEmpty(str)) return str;
string reg=":\"\"";
str = ReplaceByRegex(reg, str, ":null");
return str;
//string reg = "(?
//去掉为json中value为null的key
var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
[{"WengvNj":"df5c38c6dd1744c59605da1fc85a0500","WengvSgtm":"2019-12-16 修理合同","WengvSu":"2019TJR001LX","WengvYewm":"修理","WengvXzhbdc":"1","WengvSuam":null,"WengvXonvmkeq":"2019/12/16 0:00:00","WengvKosqjvp":"GK","WengvHapl":"SVH30","WengvWgaqoijz":"Y","WengvWgaqoiyags":"OK,同意!","WengvWgaqoixma":"wecrew","WengvWgaqoiomgs":"2019/12/16 10:20:10","WengvUrhvmkeqfhphk":"2019/12/16 0:00:00","WengvFyrbjuppnht":"2020/2/13 0:00:00","WengvWkhtrdjpnhtikskn":"2019/12/16 0:00:00","WengvWkhtrdjfnyttrlx":null,"WengvJslz":"0","WengvYxhvbzzdg":"1","WengvUgfunxeoba":null,"WengvUgfunxeyrh":"0","WengvUgfunxeegoikj":null,"WengvJdjpjxrq":null,"WengvHayznxnk":"CNY","WengvUgfunxeeha":null,"WengvXat":"4400","WengvFmlvli":"LMF","WengvYxhlndjbr":"EXW","WengvXvlkrkwzbht":null,"WengvHxlicoxma":"wecrew","WengvHxlicoomgs":"2019/12/16 10:19:46","WengvQgzbmkeq":null,"WengvAgsqm":null,"WengvTxkmanlfr":null,"WengvFoyuxnp":null,"WengvGafma":null,"WengvGafmazsaas":null,"WengvGafmaoxmvz":null,"WengvAkulxb":null,"WengvAkulxbtzicxsvswx":null,"WengvAkulxbdtvdptu":null,"WengvAkulxblpq":null,"WengvAkulxbwuaybqe":null,"WengvAkulxbwuayexffx":null,"WengvAkulxbwuaytcrae":null,"WengvGafmavtzxapd":null,"WengvGafmavtzxdweew":null,"WengvGafmavtzxsbqzd":null,"WengvGafmamzzswgc":null,"WengvGafmakabeckui":null,"WengvGafmamzzswgcusmy":null,"WengvAkulxbnaatxhd":null,"WengvAkulxbdutbieiq":null,"WengvAkulxbnaatxhdvtnz":null,"WengvHuubaknfgmeu":null,"WengvXkulyoamvfptu":null,"WengvXkulyoamvfayec":null,"WengvXkulyoamvfayecibjjb":null,"WengvWkwirbxmaost":null,"WengvWkwirbxmazxdb":null,"WengvWkwirbxmazxdbhaiia":null,"WengvXkulyoamvfhyxfmimu":null,"WengvXkulyoamvfhyxfmimuayse":null,"WengvWkwirbdutbieiq":null,"WengvWkwirbdutbieiqwuoa":null}]
下一篇:C#解决并发的设计思路
文章标题:C# Newtonsoft.Json.JsonReaderException:“Could not convert string to decimal:
文章链接:http://soscw.com/index.php/essay/46137.html