|
如果接收这样的字符串:{"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"]);
}
}
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
评分
-
查看全部评分
|