Simple way to remove escape characters from this JSON date
36,504
Solution 1
On the receiving end, if you really want to, you could just do myJsonString = myJsonString.replaceAll("\\","");
But do note that those escape characters in no way make the JSON invalid or otherwise semantically different -- the '/' character can be optionally escaped with '\' in JSON.
Solution 2
actully this not works as it throws java.util.regex.PatternSyntaxException instead of using that use
myJsonString=myJsonString.replaceAll("\\\\","");
it works fine
Solution 3
You can use Apache Commons lang:
StringEscapeUtils.unescapeJava(stringToUnEscape);
![Cody](https://i.stack.imgur.com/35BQP.jpg?s=256&g=1)
Author by
Cody
Updated on September 21, 2020Comments
-
Cody almost 4 years
In my android application, my JSON date is returned as this:
\/Date(1323752400000)\/
Is there a simple way to remove the escape characters? (This is being sent from a WCF service to an Android application). I am already using
StringEscapeUtils.unEscapeHtml4
to decode the entire serialized object.