Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple way to remove escape characters from this JSON date

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.

like image 360
Cody Avatar asked Oct 23 '25 15:10

Cody


2 Answers

actully this not works as it throws java.util.regex.PatternSyntaxException instead of using that use

  myJsonString=myJsonString.replaceAll("\\\\",""); 

it works fine

like image 72
Khan Avatar answered Oct 25 '25 04:10

Khan


You can use Apache Commons lang:

StringEscapeUtils.unescapeJava(stringToUnEscape);

Class Ref : https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringEscapeUtils.html

like image 30
vinksharma Avatar answered Oct 25 '25 05:10

vinksharma