Cody Cody - 2 months ago 18
Java Question

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.

Answer

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.

Comments