JSON.parse在Google Chrome中失败

the*_*ava 4 javascript json google-chrome

var origtext = Aes.Ctr.decrypt(recentPatientsFile.read().text, 'L0ck it up saf3', 256);
var recentPatientsList = JSON.parse(origtext);
Run Code Online (Sandbox Code Playgroud)

做一个alert(origtext),我得到空数据.JSON.parse(空数据)在其他浏览器中工作正常,但在Google Chrome中我得到了Uncaught SyntaxError: Unexpected end of input.当我删除JSON.parse(),然后一切似乎都没问题.

Oyb*_*bek 15

就这样逃避吧

var value = JSON.parse(origtext || "null");
Run Code Online (Sandbox Code Playgroud)