如你所说,JSON Blob的最外层是一个数组。因此,你的解析器将返回
JSONArray。然后可以
JSONObject从数组中获取s …
JSonArray a = (JSONArray) parser.parse(new FileReader("c:\exer4-courses.json")); for (Object o : a) { JSonObject person = (JSONObject) o; String name = (String) person.get("name"); System.out.println(name); String city = (String) person.get("city"); System.out.println(city); String job = (String) person.get("job"); System.out.println(job); JSonArray cars = (JSONArray) person.get("cars"); for (Object c : cars) { System.out.println(c+""); } }


