我从一php端获得他发过来的json数据,但是汉字部分成了{"rt":false,"msg":"\u751f\u4ea7\u6570\u636e\u5217\u8868\u4e3a\u7a7a"}(msg里应该是汉字)
    然后我用c# System.Web.Script.Serialization 下的 JavaScriptSerializer类序列化成json发给php端,但是他那解析后汉字部分成乱码了。
    php端用的是php内置的转json函数,c#端用的就是JavaScriptSerializer这个类,怎么解决这个问题?

解决方案 »

  1.   

    这是unicode 没有问题的。我用 newtonsoft.json 反序列化对象 (用nuget manager安装 install-pakcage newtonsoft.json)
        class Program
        {
            static void Main(string[] args)
            {
                var json = File.ReadAllText("json.txt");
                Console.WriteLine(json);            var result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result>(json);
                Console.WriteLine(result.msg); //输出:生产数据列表为空
                Console.Read();
            }
        }    public class Result
        {
            public bool rt { get; set; }
            public string msg { get; set; }
        }
      

  2.   

    你好,能加下qq说下吗?我qq 2652770247  谢谢~