JSONArray array = new JSONArray();
try
{
for (int i = 0; i < contactList.size(); i++){
JSONObject obj = new JSONObject();
String myString = contactList.get(i);
Log.e("Contact List",contactList.get(i));
String[] myarray = myString.split(",");
obj.put("is_private","0");
obj.put("expire_date","0000-00-00");
obj.put("name",myarray[0]);
obj.put("phone_no",myarray[1]);
obj.put("user_id", 1);
array.put(obj);
}
如何將json字符串轉換爲普通字符串?請給我答案。如何從普通字符串中生成JSON字符串?
你到底由JSON字符串是什麼意思?你的代碼有哪些問題? – Okas
你想獲得JSONArray或JSONObject的字符串? –