我试图实现
JavaScriptSerializer以解析从服务器接收的JSON字符串时遇到问题.
我实现了以下代码:
responseFromServer = readStream.ReadLine(); JavaScriptSerializer ser = new JavaScriptSerializer(); var dict = new JavaScriptSerializer().Deserialize<Dictionary<string,object>>(responseFromServer); var status = dict["notificationType"]; Debug.WriteLine(status);
我添加了使用System.Web.Script.Serialization;
Visual C#2010 Express告诉我命名空间名称Script在命名空间System.Web中不存在.因此,JavaScriptSerializer无效.