java代码

方法一:

1
2
3
4
5
JSONArray array = JSONArray.fromObject(data);
for (Object object : array) {
  JSONObject o = JSONObject.fromObject(object);
    o.get("name")
}

方法二:

1
2
3
4
5
JSONArray array = JSONArray.fromObject(data);
for (int i = 0; i < array.size(); i++) {
   JSONObject o = array.getJSONObject(i);
   o.get("name")
}

java代码

方法一:

1
2
3
4
5
JSONArray array = JSONArray.fromObject(data);
for (Object object : array) {
  JSONObject o = JSONObject.fromObject(object);
    o.get("name")
}

方法二:

1
2
3
4
5
JSONArray array = JSONArray.fromObject(data);
for (int i = 0; i < array.size(); i++) {
   JSONObject o = array.getJSONObject(i);
   o.get("name")
}

JSONArray遍历的更多相关文章

  1. JSONArray 遍历

    JSONArray 遍历   刚遇到一个接接口任务,发现其中返回数据中,是个字符串数组,数组中就是单个json形式的内容,其实应该也可以称这种数据叫做json数组吧,只不过是字符串形式.而我需要的是将 ...

  2. JSONArray 遍历方式

    第一种(java8):遍历JSONArray 拼接字符串 public static void main(String[] args) { JSONArray jSONArray = new JSON ...

  3. java JSONObject/JSONArray详解

    应用架包:json-lib-2.4-jdk15.jar.及相关依赖架包. 一.JSONObject和JSONArray对象 -------------------------------------- ...

  4. JSONObject与JSONArray

    最近在学习过程中用到了稍微复杂点的json数据需要将json数据解析出来,这里就截取一部分作为例子 1.JSONObject介绍 JSONObject-lib包是一个beans,collections ...

  5. java中JSONObject与JSONArray的使用

    JSONObject与JSONArray 最近在学习过程中用到了稍微复杂点的json数据需要将json数据解析出来,这里就截取一部分作为例子 1.JSONObject介绍 JSONObject-lib ...

  6. [转]解析json:与array,list,map,bean,xml相互转化

    一.解析json之net.sf.json 下载地址 使用netsfjson需要导入的包 JSONObject JSONArray JavaBean与json字符串互转 List与json字符串互转 M ...

  7. JSON 解析(门店)

    package com.j1.mai.action; import java.io.BufferedReader; import java.io.IOException; import java.io ...

  8. Gson解析json字符串、json数组转换成对象

    实体类: public class Product { private int id; private String name; private String date; public int get ...

  9. net.sf.json

    JSONObject package com.itlwc.test;         import net.sf.json.JSONArray;    import net.sf.json.JSONO ...

随机推荐

  1. Java 多线程Thread和Runnable

    Thread: class MyThread extends Thread { private int ticketsCont=5; //一共有5张火车票 private String name; / ...

  2. Vue 模板

    界面: html: @using Abp.Web.Mvc.Extensions @{ ViewBag.CurrentPage = "BasicDatas"; } @section ...

  3. 第十二篇 Integration Services:高级日志记录

    本篇文章是Integration Services系列的第十二篇,详细内容请参考原文. 简介在前一篇文章我们配置了SSIS内置日志记录,演示了简单和高级日志配置,保存并查看日志配置,生成自定义日志消息 ...

  4. Leetcode: Random Pick Index

    Given an array of integers with possible duplicates, randomly output the index of a given target num ...

  5. Lintcode: Sort Colors II

    Given an array of n objects with k different colors (numbered from 1 to k), sort them so that object ...

  6. VCL Tclientsocket, Tserversocket控件安装方法

    菜单component->Install Packets 按Add按钮,选择delphi目录里的bin目录下的dclsockets70.bpl(delphi2010是dclsockets140. ...

  7. 强连通+二分匹配(hdu4685 Prince and Princess)

    Prince and Princess Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Othe ...

  8. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Capture the Flag

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5503 The 12th Zhejiang Provincial ...

  9. csuoj 1022: 菜鸟和大牛

    http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1022 1022: 菜鸟和大牛 Time Limit: 1 Sec  Memory Limit: 1 ...

  10. 今天遇到的一个问题(windows的ssh客户端连接不到虚拟机Ubuntu)

    今天比较郁闷,想用windows上的ssh客户端连接虚拟机中的Ubuntu. 但是死活连不上,之前是能脸上的,所以比较郁闷. 我首先在windows上ping Ubuntu的ip地址,竟然发不了数据包 ...