我正在尝试发布一个 json 数组(listobjs):
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("data", listobjs.toString()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
response = client.execute(httppost);
我得到这个服务器响应:
11-23 13:14:23.873: E/WebServicesManager(9059): response =500
11-23 13:14:23.873: E/WebServicesManager(9059): response ={"error":{"message":"data is required","type":"Api_Exception","code":201}}
为什么服务器没有得到我的数据 JSONArray?
也许这会有所帮助,这是我在 iphone 上的做法:
data=[{"scan_user":"2289","scan_status":"2","scan_date":"2012-10-23 10:29:53","id_participant":"2969113"},{"scan_user":"2280","scan_status":"2","scan_date":"2012-10-23 10:40:53","id_participant":"2969112"}]
NSString * stringToPost = [NSString stringWithFormat: @"data=%@", [participantsListToPost JSONRepresentation]];