Javascript JSON parse unescape quotes? - Stack Overflow

I have a user entered JSON data which is then saved to other object. But instead of JSON I get dtExport

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 I fix it? Thanks.

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 I fix it? Thanks.

Share Improve this question asked Jul 26, 2015 at 19:00 fivepointsevenfivepointseven 1,0512 gold badges11 silver badges23 bronze badges 1
  • 1 Please post the problematic code. – Mike Samuel Commented Jul 26, 2015 at 19:01
Add a ment  | 

1 Answer 1

Reset to default 5

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

and next JSON.parse

results:

"{"type":"polyline"}"

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744309776a4567891.html

相关推荐

  • Javascript JSON parse unescape quotes? - Stack Overflow

    I have a user entered JSON data which is then saved to other object. But instead of JSON I get dtExport

    7天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信