JSON.parse()出错
var str='{"hideSide":"hideSide","smLogo":{"w":"11px","h":"11px"},"bigLogo":{"w":"11px","h":"11px"}}';
var str1="{'hideSide':'hideSide','smLogo':{'w':'11px','h':'11px'},'bigLogo':{'w':'11px','h':'11px'}}";
console.log(str,JSON.parse(str),str1,'\n',JSON.parse(str1))
出现下图错误,原因是json的标准格式key和value都必须加双引号而不是单引号;
复制代码