Here is my string
{ \'user\': { \'name\': \'abc\', \'fx\': { \'message\': { \'color\': \'red\' }
The answer the direct question: To be safe, replace the required character with \u+4-digit-hex-value
Example: If you want to escape the apostrophe ' replace with \u0027 D'Amico becomes D\u0027Amico
NICE REFERENCE: http://es5.github.io/x7.html#x7.8.4
https://mathiasbynens.be/notes/javascript-escapes