赞
踩
1.下载Json.Net.Unity3D,导入到Unity
2.解析字符串
- {
- "results": [{
- "location": {
- "id": "WX4FBXXFKE4F",
- "name": "北京",
- "country": "CN",
- "path": "北京,北京,中国",
- "timezone": "Asia/Shanghai",
- "timezone_offset": "+08:00"
- },
- "now": {
- "text": "晴",
- "code": "0",
- "temperature": "-10"
- },
- "last_update": "2021-01-08T09:20:00+08:00"
- }]
- }
- try
- {
- JObject data = JsonConvert.DeserializeObject<JObject>(jsonText);
- //输出‘北京’
- Debug.Log(data["results"][0]["location"]["name"]);
- }
- catch (System.Exception ex)
- {
- Debug.Log(ex.Message);
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。