我需要一些帮助来从Json String中删除反斜杠.
i need some help for Remove Back slash from Json String.
这是我从服务器端得到的响应.
Here is the Response which i Get From Server side.
"response":"{\"time_zone\":\"\",\"session_token\":\"abcdefgHijklomopqrstuvwxyz\",\"user_login\":\"abc\",\"user_profile_img\":\"jhjhjhj/system/photos/62/medium/images.jpg?1462446436\",\"success\":\"0\",\"org_admin\":\"\",\"user_id\":\"62\",\"user_org_id\":\"101\",\"phone_mobile\":\"510-427-9639\",\"user_email\":\"abc@pdmoffice\"}"}我从该字符串中删除反斜杠的目的
what i have don for Remove Backslash from this String
result.replaceAll("\\",");
result.replaceAll("\\","");
than之后,它将给我这个不在Json Formate中的字符串.
than After it will give me This String which is not in Json Formate.
{"response":"{"time_zone":"","session_token":"nskfndkjfsfsdffjsdfd","user_login":"newoff2","user_profile_img":"absdds/system/photos/62/medium/images.jpg?1462446436","success":"0","org_admin":"","user_id":"62","user_org_id":"101","phone_mobile":"510-427-9639","user_email":"hjhjh@pdmoffice"}"}给我惊喜
org.json.JSONException: Unterminated object at character 17 of {"response":"{"time_zone":"","session_token":"kjshhdscncnxzcxclx","user_login":"newoff2","user_profile_img":"abcd/system/photos/62/medium/images.jpg?1462446436","success":"0","org_admin":"","user_id":"62","user_org_id":"101","phone_mobile":"510-427-9898","user_email":"sdgas@pdmoffice"}"}如何使用适当的Json Formate删除此反斜杠?
How Can i remove this Back slash with Proper Json Formate ?
预先感谢
推荐答案命令
result.replaceAll("\\","");是正确的,如果您尝试使用在线json格式化程序显示服务器响应( jsonformatter.curiousconcept. com/),您可以清楚地看到该字符串的格式不正确.不需要在响应"后面加上双引号,而在结尾加上双引号.
is correct and if you try to display the server response with an online json formatter (jsonformatter.curiousconcept/) you can clearly see that the string is not correctly formatted. The double quotes after the "response" and one at the end are not required.
更多推荐
从Android中的Json String中删除反斜杠
发布评论