So got this JSON string,
{
"Text": "<?xml version=\"1.0\"</pi>",
"Type": "Checkin"
}
I need to deserialize it back to an object.
var returnedFileContent = '{"Text": "<?xml version=\"1.0\"</pi>","Type": "Checkin"}';
var test10 = JSON.parse(returnedFileContent);
console.log(test10)
Error:
Unexpected number in JSON at position 25
I know JS doesn't like the \" and it will work if the JSON string is:
{
"Text": "<?xml version=\\\\\\" 1.0\\\\\\ "</pi>",
"Type": "Checkin"
}
The problem is how to convert the \" to \\\".
Note: I have no control of the input JSON String.