javascript - 如何在 JavaScript 中解析 JSON?

标签 javascript c# json

我通过 AJAX 调用获取以下 JSON,由于项目符号点后的\t ,该调用无效,因此我在 JSON.Parse(data.d) 函数中收到 javaScript 错误。 您能否建议如何处理这种情况?

{ "Initial" :[ 
                       {"IncidentNumber" : "INCB68686857575" ,
                       "IncidentStart": "22-Apr-2016 11:03" ,
                       "Title": "aaa", 
                       "ServiceName": "a",
                       "Status": "Service Down",
                       "UsersImpacted": "MULTIPLE" ,
                       "Circle": "a" ,
                       "RecoveryActivity": "•\tJohn Michel USA Country nextline•\tABC DEF GDH LMN	India" ,
                       "EstimatedRestorationTime": "a" ,
                       "OwningOrLeadTeam": "a" ,
                       "SupportingTeams": "a" ,
                       "IncidentLead": "a",
                       "Resiliency": "To Be Determined",
                       "NextUpdateGMTTime": "17-May-2016 12:48" }]
}

最佳答案

使用替换

var stringified = JSON.stringify(data);
JSON.parse(stringified.replace(/"/g,'"'));  

关于javascript - 如何在 JavaScript 中解析 JSON?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37277691/

相关文章:

javascript - 通过 AJAX 将 HTML 表转换为 JSON 文件

javascript - 如何在此循环中使用 jQuery 添加类

javascript - 使用 v-if Vue 在 v-for 中添加一些逻辑

javascript - 无法在 php 中使用带进度条的 XMLHTTPRequest 提交数据

javascript - mongodb 模式中具有不同对象类型的数组

javascript - 来自数组数据的 D3 堆栈图

c# - 在 WPF 中绑定(bind)图像?

c# - HttpClient FormUrlEncodedContent 编码

c# - 将 12 小时时间转换为时间跨度 C#

json - 是否可以将 "Omitempty"json 标记作为默认行为?