我有一個應用程序,它與web服務連接。我發送Json的一些數據:看看看起來如何json
try {
JSONObject jsonObject = new JSONObject();
jsonObject.put("token", regId);
jsonObject.put("appId", GlobalConfig.getAPPLICATION_ID());
jsonObject.put("phoneId", 1);
JSONArray jArrayParam = new JSONArray();
jArrayParam.put(jsonObject);
List<NameValuePair> nameValuePair = new ArrayList<NameValuePair>();
nameValuePair.add(new BasicNameValuePair("Token",jArrayParam.toString()));
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(GlobalConfig.getSendEmail());
httppost.addHeader("Authorization", "Basic " + Base64.encodeToString(
(GlobalConfig.getAuthString()).getBytes(),Base64.NO_WRAP));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePair, HTTP.UTF_8));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
} catch (Exception e) {
// TODO: handle exception
}
我怎樣才能看到如何看起來這個json? 我想服務器看到這樣的內容:
{"Token": [
{
"token": "asdasfasf",
"appId": 8.8,
"phoneId": 142.369,
}
看到JSON在哪裏?在你的Android客戶端,或在服務器上? –
你的例子json它無效 –
我不明白的問題 – njzk2