http://json.codeplex.com/
  
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/

解决方案 »

  1.   

     JsonData code = JsonMapper.ToObject("{\"a\":\"123\"}");
    if(code["a"]!=null){
       ...
    }
      

  2.   

    我已经引用了
    using Newtonsoft.Json.Linq;
    using Newtonsoft.Json;
    这两个了具体不知道怎么写呀,我要解析这个网址的json并拿到数据,怎么操作呀???非常感谢
      

  3.   

    json是什么样的内容?using Newtonsoft.Json.Linq;
    using Newtonsoft.Json;
     private string Getjson()
            {
               
                string getUrl = "http://172.16.0.145/jsjApi/?action=BigdataList";  
                WebRequest webReq = WebRequest.Create(getUrl);
                WebResponse webResp = webReq.GetResponse();
                Stream stream = webResp.GetResponseStream(); 
                StreamReader sr = new StreamReader(stream, Encoding.UTF8);
                string html = sr.ReadToEnd();             
                sr.Close();
                stream.Close(); 
                return html;
            }
            string json =Getjson();                      
                Hashtable js = JsonConvert.DeserializeObject(json, typeof(Hashtable)) as Hashtable;
                string dataString = js["test"].ToString();
                ......
      

  4.   

    你帮我看看怎么解决呀?我以前没有解析过json,我要把这个网址的json解析拿到
      

  5.   


    这样是可以的,但是我要把解析拿到的TitleName显示做一个分页绑定到checkedListBox1上面,具体该怎么写呀???求帮助呀
      

  6.   

    我要分页显示拿到的json数据怎么做啊
      

  7.   


    using System;
    using System.Net;namespace dosoft.App_Code
    {
        public class AddressHelper
        {
            public static string PostIP = "http://ip.taobao.com/service/getIpInfo.php?ip=";
            public static AddressInfo GetAddress(string ip)
            {
                var addr = "";
                try
                {
                    using (WebClient c = new WebClient())
                    {
                        string s = c.DownloadString(PostIP + ip);
                        addr = s;
                    }
                    return Newtonsoft.Json.JsonConvert.DeserializeObject<AddressInfo>(addr);
                }
                catch (Exception)
                {
                    return new AddressInfo(){
                        code = 0,
                        data = new data() { 
                            region="未知省份",
                            city = "未知城市"
                        }
                    };
                }
            }
        }
        [Serializable]
        public class AddressInfo
        {
            public int code { get; set; }
            public data data { get; set; }
        }
        [Serializable]
        public class data
        {
            public string country { get; set; }
            public string country_id { get; set; }
            public string area { get; set; }
            public string area_id { get; set; }
            /// <summary>
            /// 省份
            /// </summary>
            public string region { get; set; }
            public string region_id { get; set; }
            /// <summary>
            /// 市
            /// </summary>
            public string city { get; set; }
            public string city_id { get; set; }
            public string county { get; set; }
            public string county_id { get; set; }
            public string isp { get; set; }
            public string isp_id { get; set; }
            public string ip { get; set; }    }
    }参考,,我这也是通过网站拿json数据并且转换的...大概差不多,自己理解下就好了同样的  我用的也是Newtonsoft.Json
      

  8.   

    调用更简单了
    var m=dosoft.App_Code.AddressHelper.GetAddress("");
    messagebox.show("省="+m.data.region);
    messagebox.show("省="+m.data.city);
      

  9.   

    我用上面的那个方法已经取到了json数据,我现在就是要把取到的json数据做分页怎么做呀???
      

  10.   

    你的分页指的是什么?你放在datagridview里?
      

  11.   


    我用这个方法已经取到了json数据并把它加入了checkedListBox1列表里面,现在我就是要把checkedListBox1显示的数据做一个分页让每页显示30条就行了,求帮助呀???急用啊
      

  12.   

    那就是控制checkedListBox1了
      

  13.   

    你这样,数据都放在一个数组里,再checkedListBox1从数组每30个来取就可
      

  14.   

    假如你将json数据放在jsondata中,放一个numericUpDown1控件,numericUpDown1增加数为30,通过调整numericUpDown1来改变checkedListBox1里的数,我给出简单代码,还要调整,只是一个思路,应该还有更好的办法。
     List<string> jsondata = new List<string> { };
        private void Form1_Load(object sender, EventArgs e)
        { 
            for(int i=0;i<100;i++)
            {
                jsondata.Add(i.ToString());        }
           
        }
     private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {        checkedListBox1.Items.Clear();
            int i=Convert.ToInt16(numericUpDown1.Value); 
            for (int j=i; j <i+ 30; j++)
            {
                checkedListBox1.Items.Add(jsondata[j].ToString());
            }
        }
      

  15.   

    你也可以将数据写到datagridview 通过分页来显示,datagridview也支持checked