我们现在时候WINFORM 项目  查询的是网页内容 返回的是JSON  怎么解析? 有什么第三方组件没有?

解决方案 »

  1.   

    WEB的直接读取,WINFORM的没搞过。function EditEmployee(EmployeeID) {
        if (EmployeeID == "") {
            alert("编辑无效,NULL!");
            return;
        }
        $.getJSON("/ajax/AA.ashx?time=" + Math.random(), { Action: "Get", ID: ID},
        function(data) {
            if (data != "") {
                $(".IsMarry").val(data.IsMarry);
                $(".Birthday").val(ChangeDateFormat(data.Birthday));
                $(".IDCard").val(data.IDCard);
                $(".BankCard").val(data.BankCard);
                $(".BankId").val(data.BankId);
                $(".EmpState").val(data.EmpState);
                $(".ScheduleDesc").val(data.ScheduleDesc);
                $(".DistrictDesc").val(data.DistrictDesc);
                $(".LicenseType").val(data.LicenseType);
            }
        });
    }
      

  2.   

    第三方插件Newtonsoft.Json 牛顿
      

  3.   

    public object Parse(string text)
            {
                lock (SyncObject)
                {
                    c = 0;                if (text == null)
                    {
                        throw new FormatException();
                    }                s = text.Trim();
                    if (s == string.Empty)
                    {
                        throw new FormatException();
                    }
    #if !DEBUG
                    try
    #endif
                    {
                        return ParseSomethingWithoutName();
                    }
    #if !DEBUG
                    catch (Exception)
                    {
                        throw;
                    }
    #endif
                }
            }
    用着 个转换
      

  4.   

    http://www.javaeye.com/topic/260936http://download.csdn.net/source/2458023
      

  5.   

    Newtonsoft.Json 这个的确不错。
      

  6.   

    用Newtonsoft.Json。
    UserInbox entity = JsonConvert.DeserializeObject<UserInbox>(data);//反序列化
    string data=JsonConvert.SerializeObject(entity);//序列化
    JObject oldAndBusted = new JObject();oldAndBusted["Name"] = "Arnie Admin";oldAndBusted["Enabled"] = true;oldAndBusted["Roles"] = new JArray(new[] { "Admin", "User" }); string oldRole = (string) oldAndBusted["Roles"][0];// Admin  dynamic newHotness = new JObject();newHotness.Name = "Arnie Admin";newHotness.Enabled = true;newHotness.Roles = new JArray(new[] { "Admin", "User" }); string newRole = newHotness.Roles[0];
      

  7.   

    下载地址:
    http://json.codeplex.com/releases/view/58535
      

  8.   

    Newtonsoft的Json解析很好用