我正在尝试解析从第三方 API 接收到的一些 JSON。问题是一些 JSON 在引号内有引号,如下所示:
var json = '{"sentence": "My favorite sport is "dodgeball"." }';
我很确定浏览器将引用解释为
"My favorite sport is"
然后在以下字符上遇到语法错误。我该如何避免这种情况?
编辑:我发布了问题的简化版本,但这是给我带来麻烦的实际代码片段(问题是用引号括起来的“ Cool Vendor ”):
{"content":"Vana Workforce is the Cloud HR Company. We are a global provider of human capital software and service solutions specifically designed to the needs of small and medium enterprises delivered on-demand.
Developed on the industry's leading cloud platform Force.com, Vana Human Capital Management delivers one complete and integrated human capital management solution for global organizations form hire to retire including the core human resource system of record, benefits & compensation, absence management, performance and talent management, career and succession planning, workforce collaboration, and workforce analytics.
Founded in 2008, Vana Workforce has offices in Canada and the United States with customers on every continent, and was recently recognized by Gartner Research as a "Cool Vendor" for 2010.","val":"Description"}