How To Escape Backslash In Javascript Object Literal
I know question is asked many times, i gone through with all the questions. but none of them is helping my situation. I have a object literal, for one of the property i assign some
Solution 1:
Solution 2:
it is a string literal where \
is an escape character so if you want to use a \
as it is then you need to escape it with another \
like \\
'localhost\\sqlserver'
Demo: Fiddle
Solution 3:
before save JSON as string into db or somethis use REGEX
JSON.stringify(drivers).replace(/"/g, '\\"')
Post a Comment for "How To Escape Backslash In Javascript Object Literal"