I'm creating json string to send to the server. I use GSon to generate json string. Because my server doesn't understand string like: \"key\":value but "key":value or "a\/b" but a/b. So after generating json string, I use replaceAll method to fix this:
String res = original.replaceAll("\\/", "/").replaceAll("\\"", "\"");
But this method doesn't work as I expected. Please tell me how to replace string to conform with server as above.
Thanks :)
\"\\"\\\\"\\\\\"You want to replace by a double-quote, so the point #4 needs to be applied again:
Same logic for the other replacement (without the point #4 since no double-quote):
Combined into one single regex: