import com.alibaba.fastjson.JSONObject;public class JSONTest {// 创建JSONObject对象private static JSONObject createJSONObject() {JSONObject jsonObject = new JSONObject();jsonObject.put("name", "张三");jsonObject.put("age", new Integer(26));JSONObject innerObj = new JSONObject();innerObj.put("university", "某某学校");innerObj.put("special", "某某专业");jsonObject.put("education", innerObj);return jsonObject;}public static void main(String[] args) {JSONObject jsonObject = new JSONTest().createJSONObject();// 输出对象System.out.println("jsonObject:" + jsonObject);// 根据key返回一个字符串String name = jsonObject.getString("name");System.out.println(name);// 输出组合对象中的属性System.out.println(jsonObject.getJSONObject("education"));}}