报错:Uncaught SyntaxError: Unexpected token u in JSON at position 0

项目执行过程中报错:

Uncaught SyntaxError: Unexpected token u in JSON at position 0

报错代码是:

JSON.parse(JSON.stringify(this.data))

这个错误的原因是因为JSON.parse()中解析的JSON错误,可能JSON串格式不对,我这里是因为他是 undefined,所以导致了这个错误,所以就要检查解析的括号里的数据是否正确。

原文地址:https://www.cnblogs.com/shiyiersan/p/13744798.html