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\\""}';
Comments
Post a Comment