主頁 > 知識庫 > litjson讀取數(shù)據(jù)示例

litjson讀取數(shù)據(jù)示例

熱門標簽:地圖標注多少錢一張 ai電銷機器人對貸款有幫助嗎 電銷機器人 數(shù)據(jù) 廣州銷售外呼系統(tǒng)定制 福州人工智能電銷機器人加盟 400電話辦理信任翰諾科技 宿遷智能外呼系統(tǒng)排名 云狐人工智能電話機器人 怎樣給陜西地圖標注顏色

1.下載并應用LitJson,DLL文件

2.建兩個類;

復制代碼 代碼如下:

   public class JsonData
    {
        public string result { get; set; }
        public ListGameData> info { get; set; }
    }


      public GameData()
        { }
        #region Model
        private int _id;
        private string _dept;
        private string _sid;
        private string _oldsid;
        private string _userid;
        private string _roleid;
        private string _rolename;
        private string _rolelevel;
        private string _gold;
        private string _money;
        private string _inittime;
        private string _lastlogin;
        private string _querytime;
        /// summary>
        ///
        /// /summary>
        public int ID
        {
            set { _id = value; }
            get { return _id; }
        }
        /// summary>
        /// 平臺編號
        /// /summary>
        public string dept
        {
            set { _dept = value; }
            get { return _dept; }
        }
        /// summary>
        /// 服務器編號
        /// /summary>
        public string sid
        {
            set { _sid = value; }
            get { return _sid; }
        }
        /// summary>
        /// 原始服務器編號
        /// /summary>
        public string oldsid
        {
            set { _oldsid = value; }
            get { return _oldsid; }
        }
        /// summary>
        /// 用戶平臺ID
        /// /summary>
        public string userid
        {
            set { _userid = value; }
            get { return _userid; }
        }
        /// summary>
        ///
        /// /summary>
        public string roleid
        {
            set { _roleid = value; }
            get { return _roleid; }
        }
        /// summary>
        /// 角色名
        /// /summary>
        public string rolename
        {
            set { _rolename = value; }
            get { return _rolename; }
        }
        /// summary>
        /// 角色等級
        /// /summary>
        public string rolelevel
        {
            set { _rolelevel = value; }
            get { return _rolelevel; }
        }
        /// summary>
        /// 金子
        /// /summary>
        public string gold
        {
            set { _gold = value; }
            get { return _gold; }
        }
        /// summary>
        /// 銀子
        /// /summary>
        public string money
        {
            set { _money = value; }
            get { return _money; }
        }
        /// summary>
        /// 角色創(chuàng)建時間
        /// /summary>
        public string inittime
        {
            set { _inittime = value; }
            get { return _inittime; }
        }
        /// summary>
        /// 最后登錄時間
        /// /summary>
        public string lastlogin
        {
            set { _lastlogin = value; }
            get { return _lastlogin; }
        }
        /// summary>
        /// 查詢時間
        /// /summary>
        public string querytime
        {
            set { _querytime = value; }
            get { return _querytime; }
        }
        #endregion Model

3.讀取數(shù)據(jù)

復制代碼 代碼如下:

  string json_str = @"{""result"":""1"",""info"":[{""sid"":""2"",""rolename"":""蒲翠柏"",""roleid"":""900001"",""lastlogin"":""2014-01-08 10:54:52"",""inittime"":""2013-11-15 12:01:05.0"",""money"":""867"",""rolelevel"":""55"",""userid"":""athena"",""oldsid"":""1"",""gold"":""9992837"",""dept"":""67"",""querytime"":""2014-01-08 11:56:38""},{""sid"":""2"",""rolename"":""噗"",""roleid"":""5700001"",""lastlogin"":""2013-11-16 18:38:54"",""inittime"":""2013-11-16 18:25:45.0"",""money"":""0"",""rolelevel"":""27"",""userid"":""athena"",""oldsid"":""1"",""gold"":""0"",""dept"":""67"",""querytime"":""2014-01-08 11:56:38""},{""sid"":""2"",""rolename"":""惠光赫"",""roleid"":""2800001"",""lastlogin"":""2013-11-15 15:00:07"",""inittime"":""2013-11-15 14:59:25.0"",""money"":""0"",""rolelevel"":""1"",""userid"":""athena"",""oldsid"":""1"",""gold"":""0"",""dept"":""67"",""querytime"":""2014-01-08 11:56:38""}]}";

               GameWindowsService.Common.JsonData jsonData = LitJson.JsonMapper.ToObjectGameWindowsService.Common.JsonData>(json_str);

                ListGameData> gameDataList = jsonData.info;
                foreach (var gameData in gameDataList)
                {
                    Common.Common.WriteFile(gameData.Add().ToString());
                }

您可能感興趣的文章:
  • js讀取json文件片段中的數(shù)據(jù)實例
  • 使用MSScriptControl 在 C# 中讀取json數(shù)據(jù)的方法
  • Android通過json向MySQL中讀寫數(shù)據(jù)的方法詳解【讀取篇】
  • 如何使用ajax讀取Json中的數(shù)據(jù)
  • PHP讀取mssql json數(shù)據(jù)中文亂碼的解決辦法
  • Android App中讀取XML與JSON格式數(shù)據(jù)的基本方法示例
  • js讀取并解析JSON類型數(shù)據(jù)的方法
  • Android中Json數(shù)據(jù)讀取與創(chuàng)建的方法
  • python讀取json文件并將數(shù)據(jù)插入到mongodb的方法
  • asp實現(xiàn)讀取數(shù)據(jù)庫輸出json代碼
  • javascript 循環(huán)讀取JSON數(shù)據(jù)的代碼
  • JSON 數(shù)據(jù)格式詳解

標簽:新疆 延安 宜春 綿陽 焦作 大興安嶺 黃南 曲靖

巨人網絡通訊聲明:本文標題《litjson讀取數(shù)據(jù)示例》,本文關鍵詞  litjson,讀取,數(shù)據(jù),示例,litjson,;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《litjson讀取數(shù)據(jù)示例》相關的同類信息!
  • 本頁收集關于litjson讀取數(shù)據(jù)示例的相關信息資訊供網民參考!
  • 推薦文章