美文网首页
解析键值jsonArray

解析键值jsonArray

作者: kany1 | 来源:发表于2018-11-19 13:53 被阅读0次

final JsonReader reader =new JsonReader(new StringReader(videoCommentRowDataVO.getCommentJson()));

// 对于格式不好的json字符串, 需要设置此项

reader.setLenient(true);

final JsonArray original =new JsonParser().parse(reader).getAsJsonArray();

final Iterator iterator = original.iterator();

while (iterator.hasNext()) {

final JsonObject obj = iterator.next().getAsJsonObject();

if ( obj.get("type").getAsInt() ==TEXT_INTRO ) {

String commentVO=obj.get("content").toString();

commentRowDataVO.setComment(commentVO);

}

}

相关文章

  • 解析键值jsonArray

    final JsonReader reader =new JsonReader(new StringReader(...

  • JSON解析数据

    JsonObject解析 和JSonArray解析: JSON创建和JSON解析: 一。效果图: 创建: 解析: ...

  • JSONArray的解析

    问题1:类似String s = "[ { },{ },{ } ]";这种结构的解析 方法一: Gson gson...

  • json解析记录

    解析键值对json

  • JSONArray 遍历

    JSONArray jsonArray = new JSONArray(paramsStr);for (int i...

  • Hive 零宽断言与中括号的踩坑记

    先交代下背景: 数据分析时需要解析json中的jsonArray对象,get_json_object函...

  • fastjson 常用api

    一、json字符串的数据解析 1.json字符串 ---> JSONObject或者JSONArray【好处就是当...

  • 解析json数据

    关于json的解析我一直都比较凌乱 所以在此做个笔记 一般json有jsonArray 和 jsonObject ...

  • json篇

    解析奇葩json。先看一下这个json有多奇葩: catList作为一个JSONArray,每个item下的子it...

  • json解析1

    手动解析 //json:也是一种数据解析格式,键值对形式 - (void)viewDidLoad { [super...

网友评论

      本文标题:解析键值jsonArray

      本文链接:https://www.haomeiwen.com/subject/xloofqtx.html