当 JsonConvert.DeserializeObject<Dictionary<string, string>> 时崩溃 错误json

问题描述

错误

System.Private.CoreLib.dll 中发生类型为“Newtonsoft.Json.JsonReaderException”的未处理异常

解析值时遇到意外字符:S.路径'',第0行,位置0。

json

{
   "Australia":"36","Austria":"12","Belgium":"2","Bulgaria":"15","Canada":"37","China,mainland":"39","Croatia":"21","Cyprus":"16","Czech Republic":"29","Denmark":"10","Estonia":"17","Finland":"9","France":"4","Germany":"3","Greece":"18","Hong Kong SAR":"44","Hungary":"19","Ireland":"20","Italy":"7","Japan":"40","Latvia":"22","Liechtenstein":"43","Lithuania":"24","Luxembourg":"23","Malta":"25","Monaco":"42","New Zealand":"38","Norway":"32","Poland":"8","Portugal":"14","Romania":"26","Singapore":"47","Slovakia":"28","Slovenia":"27","Spain":"6","Sweden":"5","Switzerland":"41","The Netherlands":"1","United Arab Emirates":"35","United Kingdom":"13","United States":"30"
}

我的字符串保存在我的项目中的 Properties.Resources 中。运行这个会使程序崩溃:

var test= JsonConvert.DeserializeObject<Dictionary<string,string>>(UTF8.GetString(Properties.Resources.country));

代码链接:https://dotnetfiddle.net/o1Z3uv

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...