public DangmuViewDataConveter(DangmuInitRsp.DangmuInitData source) { this._indexId = source.indexId; this._weixinId = source.weixinId; this._rid = source.rid; this._openid = source.openid; this._nickname = source.nickname; this._avatar = source.avatar; this._content = source.content; this._image = source.imageurl; this._type = (uint)ParseType(source.type); this._createtime = source.createtime; this._head = null; this._body = null; }
void test() { string testString = "{ \"ret\": 0, " + "\"data\": " + " [" + " {" + " \"id\": \"19\", " + " \"weid\": \"3\", " + " \"rid\": \"2\", " + " \"openid\": \"oYZTz0n7_wbHTNjn9euQCdDjO2p0\", " + " \"nick_name\": \"Nopromises\", " + " \"avatar\": \"http://wx.qlogo.cn/mmopen/vi_32/OJcLpmXK9LVicBl9PgMyjQroh2XDPkh6AB6C1W3bxqEtVoOhbKcq546LBU4xlJxlFUhaia7u1rm1Gz1GH90ZIMwA/0\"," + " \"content\": \"hello world 啊啊啊啊啊啊啊啊\"," + " \"type\": \"1\"," + " \"status\": \"1\"," + " \"createtime\": \"1513326199\"," + " \"txt\": \"hello world 啊啊啊啊啊啊啊啊\"," + " \"name\": \"Nopromises\"," + " \"img\": \"http://wx.qlogo.cn/mmopen/vi_32/OJcLpmXK9LVicBl9PgMyjQroh2XDPkh6AB6C1W3bxqEtVoOhbKcq546LBU4xlJxlFUhaia7u1rm1Gz1GH90ZIMwA/0\"" + " }," + " {" + " \"id\": \"16\"," + " \"weid\": \"3\"," + " \"rid\": \"2\"," + " \"openid\": \"oYZTz0rXfW2NmeQry9K90F6S29So\"," + " \"nick_name\": \"雪花神剑\"," + " \"avatar\": \"http://wx.qlogo.cn/mmopen/vi_32/IN2icsuhGqEdGribiaXf6oqCWLZAh0V6Z5UiacN6sbGyzXibjLomY5It6CSGia9190XAMPTB7NkD0jc4pTXZ9r9Dw5PQ/0\"," + " \"content\": \"http://yxbwx.mmarket.com/weizannew/attachment/images/meepo_xianchang/N5kkwL2SvlY2N714sy1knAy7L112zu.jpg\"," + " \"type\": \"2\"," + " \"status\": \"1\"," + " \"createtime\": \"1513308112\"," + " \"txt\": \"http://yxbwx.mmarket.com/weizannew/attachment/images/meepo_xianchang/N5kkwL2SvlY2N714sy1knAy7L112zu.jpg\"," + " \"name\": \"雪花神剑\"," + " \"img\": \"http://wx.qlogo.cn/mmopen/vi_32/IN2icsuhGqEdGribiaXf6oqCWLZAh0V6Z5UiacN6sbGyzXibjLomY5It6CSGia9190XAMPTB7NkD0jc4pTXZ9r9Dw5PQ/0\"" + " }" + " ]" + "}"; JsonData _jsonObect = JsonMapper.ToObject(testString); int result = int.Parse(_jsonObect["ret"].ToString());//_jsonObect["ret"]; //_jsonObect.GetField (ref Result, "ret"); Debug.Log("LoginManager#################result is:" + result); //data array partition... JsonData _jsonArray = _jsonObect["data"]; //JSONObject _objectListTemp = _jsonObect.GetField ("data"); if (null == _jsonArray) { Debug.LogError("DangmuInitRsp: data get failed!"); return; } //Get array list.. foreach (JsonData item in _jsonArray) { DangmuInitRsp.DangmuInitData _jo = new DangmuInitRsp.DangmuInitData(); uint itemp = uint.Parse(item["id"].ToString()); _jo.indexId = itemp; itemp = uint.Parse(item["weid"].ToString()); _jo.weixinId = itemp; itemp = uint.Parse(item["rid"].ToString()); _jo.rid = itemp; Debug.Log("LoginManager#################indexId is:" + _jo.indexId); Debug.Log(" #################weixinId is:" + _jo.weixinId); Debug.Log(" #################rid is:" + _jo.rid); _jo.openid = item["openid"].ToString(); _jo.nickname = item["nick_name"].ToString(); _jo.avatar = item["avatar"].ToString(); _jo.content = item["content"].ToString(); itemp = uint.Parse(item["type"].ToString()); _jo.type = "text"; //itemp = uint.Parse(item["status"].ToString()); //_jo.status = itemp; _jo.createtime = item["createtime"].ToString(); //_jo.text = item["txt"].ToString(); //_jo.name = item["name"].ToString(); _jo.imageurl = item["img"].ToString(); //Debug.Log ("LoginManager#################text is:" + _jo.text); Debug.Log(" #################name is:" + _jo.nickname); Debug.Log(" #################imageurlis:" + _jo.imageurl); //_textPool.Add(_jo); dataList.Add(_jo); } }