使用net.sf.json-lib,如何将“[0]”添加为JSONObject字符串元素?

时间:2013-01-22 02:41:45

标签: json json.net

我正在使用net.sf.json-lib,当我尝试添加值为“[0]”的字符串元素时,它将自动成为一个数组!如何将“[0]”保持为字符串,而不是数组?

JOSNObject json = new JSONObject();
// I want the value alway be string
// even if the value is "[0]"
json.element("name", "[0]");
// here it will become an array!!!

我应该怎么做才能阻止这种自动转换?

由于

0 个答案:

没有答案