Unity解析Json

LitJson 解析
1.引入頭文件
using LitJson;
2.寫一個對應的模型 相當於一個類
3. 使用流找到路徑
   string  weatherjson = System.IO.File.ReadAllText(Application.dataPath + "/Weather.json");
4. 藉助工具
 AA root = JsonMapper.ToObject<AA>(weatherjson);
AA 爲創建的模型類
5. 可以使用已經解析的文本了
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章