[英]JsonObject.GetNamedString is returning   instead of space
GetNamedString method of JsonObject is returning   for space. JsonObject的GetNamedString方法返回&nbsp空间。 For ex." The String " is returned as  The String . 例如,“ String”作为&nbspThe String&nbsp返回。 Is there any workaround to fix this issues? 是否有解决此问题的解决方法?
how about running it through HtmlDecode or ConvertToText - depending on what content you expect in the string: 如何通过HtmlDecode或ConvertToText运行它-取决于您期望在字符串中包含什么内容:
JsonObject s = new JsonObject();
s.Add(new KeyValuePair<string, IJsonValue>("val", JsonValue.CreateStringValue(" The String ")));
var t = System.Net.WebUtility.HtmlDecode(s.GetNamedString("val"));
By the way, I did have to explicitly put the nbsp;
顺便说一句,我确实必须明确地放置nbsp;
in the string to get it to appear, so suspect the JSON you are getting has that embedded (versus it just doing so by default). 在字符串中使其显示,因此请怀疑您获取的JSON已嵌入该字符串(与之相反,默认情况下只是这样做)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.