I have a String like this:
private String jsonString = "{\"test\":\"value \\\"ciao\\\" \"}"
At runtime this should be: {"test":"value \"ciao\" "}
Now I want to remove the only the first level of escape and leaving the nested escape.
The result should be:
{"test":"value "ciao" "}
How can I do this? Is it possible with methods like replace()
or replaceAll()
?
2
Answers
You can use
replaceAll()
like this:You can use the String#translateEscapes method.
Output