Android 使用json传递字符串数组
目前我正在一个android项目中工作,我需要使用json将数组用户[电子邮件],用户[密码]传递到网页…如果有人能帮我尽快调整此宽度,请…谢谢 我不知道你的意思。但我想你需要这样的东西:Android 使用json传递字符串数组,android,arrays,json,Android,Arrays,Json,目前我正在一个android项目中工作,我需要使用json将数组用户[电子邮件],用户[密码]传递到网页…如果有人能帮我尽快调整此宽度,请…谢谢 我不知道你的意思。但我想你需要这样的东西: JSONObject jsonObj = new JSONObject(); jsonObj.put("email", email); jsonObj.put("password", password); // Create the POST object and add the parameters Htt
JSONObject jsonObj = new JSONObject();
jsonObj.put("email", email);
jsonObj.put("password", password);
// Create the POST object and add the parameters
HttpPost httpPost = new HttpPost("http://api.readfa.st/session");
StringEntity entity = new StringEntity(jsonObj.toString(), HTTP.UTF_8);
entity.setContentType("application/json");
httpPost.setEntity(entity);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(httpPost);`
您可以在这里查看更多文档
详细描述您的问题。。。。
JSONArray jsonArray = new JSONArray(listOfUsers);
String jsonRepresentationForListOfUsers = jsonArray.toString();