VM603:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1

2023-05-17,,

再用JQuery解析json的时候出现了这样一个问题

VM603: Uncaught SyntaxError: Unexpected token o in JSON at position 

通过查阅资料发现,是由于解析json文件的时候解析到object而引起的错误。通过console.log的输出,发现输出的结果是一个类似于数组的输出内容。

通过寻找发现由于JQuery版本的升级,JQuery的ajax方法发生了变化,ajax的sucess的回调值直接将json解析,造成了这种错误。

所以在版本的JQuery中,并不需要手动解析Json,直接调用即可。

参考资料:

1.VM603:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1?

2.jQuery AJAX call returns [object Object]

3.JSON.parse()方法之后报错

4.jQuery.parseJSON()

VM603:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1的相关教程结束。

《VM603:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1.doc》

下载本文的Word格式文档,以方便收藏与打印。