派大星爱吃小鱼干

Uncaught SyntaxError: Unexpected

2020-04-21  本文已影响0人  程序猿阿峰
var c = "[{'mid':'28275','url':'\/static\/image\/realNameImage\/2020\/January\/7\/A30gdmb2_750X1000.png'}, {'mid':'28275','url':'\/static\/image\/realNameImage\/2020\/January\/7\/A30gdmb2_750X1000.png'}]"

console.log(JSON.parse(c))

一看这代码完全是没毛病,可是总有意想不到的红色出现;
Uncaught SyntaxError: Unexpected token ' in JSON at position 2 at JSON.parse (<anonymous>) at <anonymous>:1:18

image.png

可是我这样一操作,又没毛病了;

var c = '[{"cid":"28275","url":"\/static\/image\/realNameImage\/2020\/January\/7\/5wMUlxsZ_750X1000.png"},{"cid":"28275","url":"\/static\/image\/realNameImage\/2020\/January\/7\/PE4ju0oT_750X1000.png"}]'

console.log(JSON.parse(c))

又正常了,fuck,why?;


image.png

这是啥原因?

上一篇下一篇

猜你喜欢

热点阅读