json通过gson的包转JsonArray
来源:互联网 发布:python 不定积分 编辑:程序博客网 时间:2024/06/08 18:07
Gson gson = new Gson();JsonParser parser = new JsonParser();JsonArray Jarray = parser.parse(jstring).getAsJsonArray(); ArrayList<channelSearchEnum> lcs = new ArrayList<channelSearchEnum>(); for(JsonElement obj : Jarray ){ channelSearchEnum cse = gson.fromJson( obj , channelSearchEnum.class); lcs.add(cse); }
这方法是当参数中只有list是使用的。
当参数中还有其他属性时,
String json= "{\"pids\":[\"1\",\"2\",\"3\"]}";System.out.println(new JsonParser().parse(json).getAsJsonObject().getAsJsonArray("pids").get(0).getAsString());
阅读全文
0 0
- json通过gson的包转JsonArray
- JSON解析 Gson解析方式 JSONObject JSONArray
- Google的JSON包GSON使用指南
- net.sf.json.JSONArray 所在的jar包,依赖bao
- 通过GSON解析json
- Android中Json的全解析(JSONObject,JSONArray,Gson,Jackson)
- json&jsonArray&gson&list&List<Map<String,Object>>&listview&adapter
- 通过Gson解析Json数据
- 通过Gson解析Json数据
- gson解析通过okhttp获取的json格式数据
- 通过google的gson把xml转成json
- 谷歌推出的json解析jar包Gson
- 用Gson包进行解析本地的json文件
- 用Gson包进行解析本地的json文件
- Json-rpc的JsonArray比Json-lib 的JsonArray
- json学习:JSONArray的应用
- JSON之JSONArray的使用
- Json的JSONArray和JSONObject
- 排查在 Azure 中创建、重启 Windows VM 或调整其大小时发生的分配失败
- 活动安排问题
- Egret快速入门
- Java反编译工具使用对比,最好用的Java反编译工具 --- JD-GUI、XJad
- frame标签
- json通过gson的包转JsonArray
- maven 禁用插件
- c++学习笔记之基础篇
- Maven下解决Cannot change version of project facet Dynamic Web module to 3.0
- StringBuffer
- oracle 日期查询
- 94、java的IO操作-合并流
- php冒泡排序
- python 中全局变量的修改