开始看网上关于json的例子程序段,实验了一把发现结果和网上例子程序的结果不一致,后来发现使用json需要导入的jar包不全,只导入json-lib-2.2.2-jdk15.jar ,还需以下几个包:commons-beanutils-1.7.0.jarcommons-collections-3.2.jarcommons-lang.jarcommons-logging-1.1.jarezmorph-1.0.4.jar这时在测试得到了想要的结果Question q2 = new Question();q2.setId(2);q2.setDescription("descrsssss");q2.setPointInfo("pointkkkk");q2.setType(3);Question q1 = new Question();q1.setId(1);q1.setDescription("descrsssss");q1.setPointInfo("pointkkkk");q1.setType(3);JSONObject jsonObject = new JSONObject().fromObject(q2);System.out.println(jsonObject);List list = new ArrayList();list.add(q1);list.add(q2);JSONArray jsonArr= JSONArray.fromObject(list);System.out.println(jsonArr);输出:{"description":"descrsssss","id":2,"pointInfo":"pointkkkk","type":3}[{"description":"descrsssss","id":1,"pointInfo":"pointkkkk","type":3},{"description":"descrsssss","id":2,"pointInfo":"pointkkkk","type":3}]页面$.post("showQuestions?type="+type,null,callbackShowQuestions,"json");这时在回调函数的参数data获得的就是json转换后的js对象数组,以下标方式便可访问数组里的相应对象信息。