[
{
id: "1",
name: "Victor"
},
{
id: "2",
name: "Leo"
}
]
hi! 剛剛 有查了一下 是使用 JSONObject 的方式把查詢出來的資料 寫成 Json 嗎?
對阿!
http://blog.csdn.net/aa4790139/article/details/8587208
您如果是陣列轉 JSON,可以這樣使用
//People 的欄位對應您的 Table member
People[] peopleArray = new People[];
//...
//將 SQL 查出來的資料填入 People 陣列
//...
JSONArray jsonArray = JSONArray.fromObject(peopleArray);
String json = jsonArray.toString();
謝謝大大!
Json 是一種資料傳輸格式
可以參考網路上種多使用Android操作Json的範例
Android使用Json