public static void main(String[] args) { String path = JsonTest.class.getClassLoader().getResource("students.json").getPath(); String s = readJsonFile(path); JSonObject jobj = JSON.parseObject(s); JSonArray student = jobj.getJSonArray("students");//构建JSONArray数组 for (int i = 0 ; i < student.size();i++){ JSonObject key = (JSONObject)student.get(i); int stuId= (Integer)key.get("stuId"); String stuName= (String)key.get("stuName"); int stuAge= (Integer)key.get("stuAge"); #TODO 数据库操作 System.out.println(stuId); System.out.println(stuName); System.out.println(stuAge); } }