我有代码看起来是这样的:不希望的输出,似乎是一个数组
import net.sf.json.*;--just so you know what the library is
...
JSONArray a = new JSONArray();
JSONObject p = new JSONObject();
p.put("some_attribute1","some normal string");
p.put("some_attribute2","[3something]");
p.put("some_attribute3","[something3]");
a.add(p);
System.out.println(a.toString());
这产生:
[
{
"some_attribute1":"some normal string",
"some_attribute2":["3something"],
"some_attribute3":"[something3]"
}
]
而不是所希望的结果:
[
{
"some_attribute1":"some normal string",
"some_attribute2":"[3something]",
"some_attribute3":"[something3]"
}
]
注意“some_attribute2”是实际输出中的数组与字符串中的字符串之间的区别所需的输出。任何人都可以解释为什么这是?此外,如果有什么更好的分类我的问题的术语?
看起来像一个错误。我敢打赌,开发者会对bug报告感到高兴。 – kutschkem
是啊......我在代码页上发现了错误,看起来项目不再被支持......看到我的答案。 – Reimius