我正在使用以下代码解析我的Android应用程序中的JSON。
String result = postHttpResponse(uri, json);
try {
JSONObject jsonResult = new JSONObject(result);
boolean authenticated = jsonResult.getBoolean("Authenticated");
if(authenticated){
user = new User();
JSONObject jsonUser = (JSONObject) jsonResult.get("User");
user.setName(jsonUser.getString("Name"));
user.setUserId(jsonUser.getString("UserId"));
}
} catch (JSONException e) {
Log.e(TAG, e.getMessage());
}
jsonUser.getString(“UserId”)返回值“corp \\ ns0017”而不是“corp \ ns0017”。 Actualy它正在用一个“\”转义字符串中的字符“\”。但在解析时我想删除额外的“\”。我怎样才能实现它?