JSON Javascript escape

前端 未结 4 831
我在风中等你
我在风中等你 2020-12-07 02:23

So i have some of my example dynamic JSON below, what i\'m having trouble doing is escaping everything properly so that it is properly processed by JSON.parse or Jquery.pars

4条回答
  •  误落风尘
    2020-12-07 02:45

    According to JSONLint, your problem is on this line:

    "title": "Windows Phone 7 Connector for Mac updated for WP8, rebranded simply as \'Windows Phone\'",
    

    If you remove the backslashes on ', it validates. In JSON, you don't escape '

    Unfortunately, since you are using ' to delimit your string, you'll need to find another way to escape it. You could use \u0027 in place of \'.

提交回复
热议问题