Convert string to JSON object in Javascript -


i have string in format:

var abc = "{'abc':'25117', 'data':'india\"newdelhi\"'}" 

i want convert json object.

i've tried use "" , '' interchanging them.

i've used function json.parse(abc), works if string

var abc = '{"abc":"25117", "data":"india\'newdelhi\'"}' 

but want "newdelhi" should in double quotes i.e. "" , strict condition.

stick valid json, , double escape quotes

var abc = '{"abc":"25117", "data":"india\\"newdelhi\\""}'; 

fiddle


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -