In JSONObject I have put {"text":"\folder1\folder2\filename.txt"}
.
It is serialized as {"text":"\\folder1\\folder2\\filename.txt"}
instead of {"text":"\folder1\folder2\filename.txt"}
.
Why is it adding extra forward slash?
In JSONObject I have put {"text":"\folder1\folder2\filename.txt"}
.
It is serialized as {"text":"\\folder1\\folder2\\filename.txt"}
instead of {"text":"\folder1\folder2\filename.txt"}
.
Why is it adding extra forward slash?
Therefore the \ must be escaped for the JSON to be valid.according JSON spec. your parser will also remove the second \ when reading the JSON.
read this JSON spec.read this answer