我通过 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/