Javascript JSON parse unescape quotes?

后端 未结 1 1946
孤街浪徒
孤街浪徒 2021-01-24 10:14

I have a user entered JSON data which is then saved to other object. But instead of JSON I get dtExport: \'{\\\\\"type\\\\\":\\\\\"polyline\\\\\"}.

How can

相关标签:
1条回答
  • 2021-01-24 10:42

    var x = '{\"type\":\"polyline\"}'; x = x.replace(/\"/g, "\"");

    and next JSON.parse

    results:

    "{"type":"polyline"}"
    
    0 讨论(0)
提交回复
热议问题