【发布时间】:2013-04-29 05:30:50
【问题描述】:
我正在尝试使用 org.json 库在 java 中创建一个 json 字符串,下面是代码 sn-p。
JSONArray jSONArray = new JSONArray();
JSONObject jSONObject = new JSONObject();
jSONObject.accumulate("test", jSONArray);
System.out.println(jSONObject.toString());
我希望它会打印出来
{"test":[]}
在打印时
{"test":[[]]}
【问题讨论】:
-
这是一个演示如何使用 org.json 创建 JSONObject 的短视频。 youtube.com/watch?v=-qEpxIARKxE