friends
This is my code
var j = '[{"id":"151","name":"As aventuras de PI","picture":null}]'
JSON.parse(j)
and it keeps saying "unexpected token"
This happens in the main page of my website. But in many other pages it works fine and I use the same functions (in PHP and in Javascript) to generate this string
Whats wrong with my JSON?
You have a non-printing character between '
and [
.
Copy/pasting your code to jsbin makes it visible:
Delete those three characters and retype them.
将文件另存为UTF-8,不带BOM(为此使用Notepad ++),并修复了错误
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.