Skip to content
Advertisement

JSON.parse incorrect string format

i have this string:

JavaScript

and i want it to become like this:

JavaScript

I tried with stringify and replace and i ended up with

JavaScript

And from here i wanted to replace the single quotation marks ' with double quotation marks " but when i did, in beginning and ending of the string appeared an extra "

JavaScript

Any tips on how to get the correct format?

Advertisement

Answer

JavaScript

this got me what you wanted, it replaces all the single quotes with double quotes, then it removes any back slashes

the result is

‘{“Ovcount”:”0″,”S1″:”LU”,”S2″:”NewClientOrMove”,”memoToDisplay”:”LU — New Client or Move”}’

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement