post.setEntity(new UrlEncodedFormEntity(params,"utf-8"));
HttpResponse httpResponse = httpClient.execute(post);
if(httpResponse.getStatusLine().getStatusCode() == 200)
{
String result = EntityUtils.toString(httpResponse.getEntity(),"utf-8");
return result;
}
result = 02-13 12:12:04.011: INFO/System.out(951): ?[{"id":"2","user":"gc","psw":"okokok"}]
JSONArray array=new JSONArray(result);
这个地方报错
02-13 11:57:20.652: ERROR/test(568): org.json.JSONException: Value ? of type java.lang.String cannot be converted to JSONArray
------解决方案--------------------
String jsonString = "{\"FLAG\":\"flag\",\"MESSAGE\":\"SUCCESS\",\"name\":[{\"name\":\"jack\"},{\"name\":\"lucy\"}]}";
JSONObject result = new JSONObject(jsonString);
JSONArray nameList = result.getJSONArray("name");
参考 http://blog.csdn.net/vincent_czz/article/details/7333977