+ Start a Discussion

Escape double quote and backslash from a Json string

I am looking for code to escape double quote and backslash.
String val='my "test" \string';
after escape it should display
my "test" \string

thanks in advance.
Nidhi L SharmaNidhi L Sharma
Hi Kabu,

On adding escape character  before special characters would resolve your issue.

String val='my \"test\" \\string';

Hope it helps you.
I have a string like
{"a":"123", "b":" why my code not working, what is the error's"}
b="why my code not working, what is the error's"
I am getting error on Parsing Invalid Character