2012-02-06 5 views
4
var origtext = Aes.Ctr.decrypt(recentPatientsFile.read().text, 'L0ck it up saf3', 256); 
var recentPatientsList = JSON.parse(origtext); 

alert(origtext) 일 때 빈 데이터가 나타납니다. JSON.parse (빈 데이터)는 다른 브라우저에서 잘 작동하지만 Google 크롬에서는 Uncaught SyntaxError: Unexpected end of input이됩니다. JSON.parse()를 제거하면 모든 것이 잘된 것처럼 보입니다.JSON.parse가 Google 크롬에서 실패합니다

답변

15

그냥이

var value = JSON.parse(origtext || "null"); 
처럼 탈출
관련 문제