import com.alibaba.fastjson.JSONObject; public class JsonTest { public static void main(String[] args) { JSONObject jsonObject = new JSONObject(); jsonObject.put("boolean", true); jsonObject.put("int", 1); jsonObject.put("str", "Helllo world"); jsonObject.put("null", null); System.out.println(jsonObject); } }
结果打印:
{"str":"Helllo world","boolean":true,"int":1}
时间: 2024-10-14 08:19:14