Unity3D Json LitJson Data解析服务端代码
如果接收这样的字符串:{"Data":{"UserID":"26","NickName":"werw@163.com","AssociationID":"0","VipHeader":"0","VipLevel":"0","Level":"0","Exp2Level":"0","Exp":"0","ExpRate":"0.00","Money":"0","MoneyRate":"0.00","Gold":"0","MaxPower":"0","CurPower":"0","TaskSec":"0","FinshGuideTask":"0","Vigour":{"VigourValueMax":"200","VigourRecoverTime":0,"VigourRecoverRate":"0.20","VigourRecoverTMaxSec":21600},"Strength":{"StrengthValueMax":"5","StrengthRecoverTime":0,"StrengthRecoverRate":"0.20","StrengthRecoverTMaxSec":21600}},"Verify":"7581f48a093bc40c54c28615e1d7ddab"}Plugins\LitJson dll此目录
http://lbv.github.io/litjson/
最新litjson包
jsonmapper已支持IOS
首先下载一个LitJson 放在 asset 文件夹plugins中
然后写一个脚本
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
using LitJson;
public class Script : MonoBehaviour {
public string strURL="http://u3dchina.com/?CH=Users&Opt=View&UserID=26";
// Use this for initialization
void Start () {
StartCoroutine(GetMethod());
}
IEnumerator GetMethod()
{
WWW getwww=new WWW(strURL);
yield return getwww;
print (getwww.data);
JsonData jd=JsonMapper.ToObject(getwww.data);
print (jd["Data"]["UserID"]);
print (jd["Data"]["Vigour"]["VigourValueMax"]);
print (jd["Verify"]);
}
}
这个ios上面是不可以用的,jsonmapper无法使用 江南 发表于 2013-3-15 10:02 static/image/common/back.gif
这个ios上面是不可以用的,jsonmapper无法使用
怎么测试的呢 jsonfx可以吗
感谢楼主的无私分享!{:soso__11402694654016840197_7:} js编程用litJSON在IOS下时不时会出错 jsonmapper无法使用... 很不错 真心顶 难得一见的好帖 说的非常好
页:
[1]