嗨我在JSONObject的转义序列中遇到小问题。
JSONObject imageObject = new JSONObject();
JSONArray imageArray = new JSONArray();
String imageId = "1/1";
if (isPOD) {
try {
imageObject.put("docidx", imageId);
imageObject.put("docapp", "LKM");
imageObject.put("docentity", "DOS");
imageObject.put("doctype", "PIC");
imageObject.put("docname", imageTitle);
imageObject.put("docsize", "" + imageSize);
imageObject.put("docext", "jpg");
imageObject.put("docdata64", "");
imageObject.put("doctxt", documentText);
} catch (JSONException e) {
e.printStackTrace();
}
imageArray.put(imageObject);
}
输出如下:
12-11 17:49:31.437: I/Parameter(29959): [{"docdata64":"","docentity":"DOS","docsize":"3709","docapp":"LKM","docext":"jpg","doctxt":"fhuuhf","docname":"LKM-PIC_2014-12-11_17:49:31_1\/3","doctype":"PIC","docidx":"1\/1"}]
我将此JSONArray转换为字符串,并使用
将其作为参数传递给POST方法listLocal.add(22, new BasicNameValuePair("document", "" + imageArray));
当这个被添加到总请求并发送到WS时,我得到额外的转义序列需要有关如何处理转义序列的帮助。
12-11 17:49:32.238: E/param(29959): {"root":{"os":"4.4.2","res":"1280x800","evttime":"17:49:31","gpslon":"79.7898222","dev":"samsung-SM-T231","evtnat":"A","nbcall":"5","ver":"2.0","net":"WIFI","evtctname":"vhhhff","lang":"EN","evtdate":"20141211","ttp":"1418300372","document":"[{\"docdata64\":\"\",\"docentity\":\"DOS\",\"docsize\":\"3709\",\"docapp\":\"LKM\",\"docext\":\"jpg\",\"doctxt\":\"fhuuhf\",\"docname\":\"LKM-PIC_2014-12-11_17:49:31_1\\\/3\",\"doctype\":\"PIC\",\"docidx\":\"1\\\/1\"}]","evttxt":"ghhhgg","shp":"80201\/L2\/74","evtctry":"BM","uuid":"77179677924A49A58FD16D2","evtfam":"G","evtcod":"DEL","evtloc":"dfggg","gpslat":"11.9402385"}}
提前感谢您的帮助。