數組我想創建一個JSON字符串作爲對象的數組,像這樣:代表JSON作爲對象的JAVA
[
{
"alertid": "1",
"alerttext": "This is test",
"alertdate": "2010-02-11 09:03:40"
},
{
"alertid": "2",
"alerttext": "Another alert",
"alertdate": "2010-02-11 09:11:04"
}
]
的JAVA JSON對象put方法是這樣的:jsonObject.put(字符串密鑰,收集值);
當我進入我的鑰匙和收藏,我的JSON是這樣的:
{
"JSONObject": [
{
"alertid": "1",
"alerttext": "This is test",
"alertdate": "2010-02-11 09:03:40"
},
{
"alertid": "2",
"alerttext": "Another alert",
"alertdate": "2010-02-11 09:11:04"
}
]
}
我怎樣才能讓我的JSON字符串看起來像第一個字符串時,我不得不put方法的簽名?
你可以發佈你的例子嗎?謝謝 –