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}

相关文章:

  • 2022-12-23
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2022-02-12
相关资源
相似解决方案