1、在代码中通过JSON.parse()进行转换,发现如下图所示报错了。其实主要原因是单引号和双引号引起的问题。如果转义的字符串进行了赋值,那么上面一层代码会多了一层的转义。这里加2个JSON.parse()是因为,第一次转换的时候还是个字符串。我们要在json字符串前后手动加上双引号,然后在进行JSON.parse()的转换即可。
JSON.parse(JSON.parse('"' + this.$route.query.formFirstSaveObjAll + '"'))
- SyntaxError atposition Expected property JsoNsyntaxerror atposition expected property syntaxerror staticrende unexpected expected syntaxerror property浏览器 对象 json c_cpp_properties properties setting atposition syntaxerror unhandledpromiserejectionwarning syntaxerror syntaxerror unexpected uncaught页面 codepoint syntaxerror unexpected amp expected