SimpleJson解析及调用
来源:互联网 发布:企业cms 编辑:程序博客网 时间:2024/05/01 11:00
[ { "id": 0, "title": "Relive" }, { "id": 1, "title": "Buy Coin" }]
简单的json数组形式
解析方法:
public int use_id {get;set;}public string use_title{get;set;}读取方法:
public class TestJsonReadData {public static List<TestJsonField>JsonR(){TextAsset txt =Resources.Load<TextAsset> ("123");JSONNode json_object = JSON.Parse (txt.text);List<TestJsonField> JsonListRead = new List<TestJsonField>();for (int i = 0; i < json_object.Count; i++) {TestJsonField fieldRead = new TestJsonField();fieldRead.use_id = json_object [i] ["id"].AsInt;fieldRead.use_title = json_object [i] ["title"];JsonListRead.Add (fieldRead);}return JsonListRead;}
第二种
{"cost":[ { "id": 0, "title": "Relive" }, { "id": 1, "title": "Buy Coin" }]}
“cost”作为json中唯一的主条目,值是包含6个条目的数组。
解析方法:
同上
读取方法:
public class TestJsonReadData { public static List<TestJsonField>JsonR() { TextAsset txt =Resources.Load<TextAsset> ("123"); JSONNode json_object = JSON.Parse (txt.text); List<TestJsonField> JsonListRead = new List<TestJsonField>(); JSONNode T = json_object [0];for (int i = 0; i < T.Count; i++) { TestJsonField fieldRead = new TestJsonField(); fieldRead.use_id = T [i] ["id"].AsInt; fieldRead.use_title = T [i] ["title"]; JsonListRead.Add (fieldRead); } return JsonListRead; } }以“T” 作为 list[0],读取 list[0] 中的内容。
0 0
- SimpleJson解析及调用
- go-simplejson|解析json字符串
- simplejson json
- shell自定义函数及参数调用解析
- 接口的调用及xml的解析
- singleCall单来源调用解析及实现
- python读取JSON simplejson
- django 使用simplejson (tip)
- Python install Simplejson
- Python 2.5安装simplejson
- python中的simplejson模块
- python json simplejson
- NuGet 安装 SimpleJson
- python安装simplejson
- golang simplejson 使用笔记
- python中simplejson模块
- python安装simplejson
- simplejson模块介绍
- RGB 转 edp 接口dp501 示范电路
- MySQL的批处理
- PHP XML和数组互相转换
- 6-I&O Multiplexing-The 'select' and 'poll' Functions
- java中的权限修饰符
- SimpleJson解析及调用
- HHU 1001 汽水瓶(模拟)
- JavaEE项目实战(OA系统)之九_部门管理之三
- MySQL学习笔记六
- bash shell中expr命令下几种的使用
- java中的Date,Calendar,String
- 【JAVA I/O】JAVA I/O类库基本架构图
- 热门威胁情报库深入分析(三)
- c++虚继承(2)