Uni-AppUnexpected token u in JSON at position 0

Posted 宾有为

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Uni-AppUnexpected token u in JSON at position 0相关的知识,希望对你有一定的参考价值。

1、JSON解析的时候解析到的数据不是一个JSON数据,请确认你的JSON数据是否为空或其他问题

2、保存刷新的时候内置浏览器会自动刷新当前页面,如果你的JSON数据是在上一个页面传值过来的话,这时候在接收数据页解析JSON也会报该错误,因为此时并没有相关的JSON数据从上一个页面传递过来

3、也可以通过判断是否为null来解决这个问题

if(jsonData != null)
	JSON.parse(jsonData)

本文参考自:海上小绵羊

以上是关于Uni-AppUnexpected token u in JSON at position 0的主要内容,如果未能解决你的问题,请参考以下文章

js、javascript : Uncaught SyntaxError: Unexpected token u

如何使用 unicode 从 python 服务解析 JSON? SyntaxError: Unexpected token u

安装TA-Lib时报错:ubuntu****, Command "/usr/bin/python -u -c "import setuptools, tokenize;__file

运行测试时邮递员错误:JSONError: Unexpected token u in JSON at position 0

[system]SyntaxError: Unexpected token u in JSON at position 0

uniapp SyntaxError: Unexpected token u in JSON at position 0 解决方案