猿问

json格式问题

当我解析出json的时候,报错

代码:`
{"id":"69","title":"测试标题","content":"测试内容 ","time":"2017-07-25 09:01:16","hits":"37","art_love":"0"}]}
`

报的错误是:

Error: Parse error on line 5:

...??",                "content": "测试内容

----------------------^

Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'


幕布斯6054654
浏览 561回答 1
1回答

炎炎设计

const a='{"id":"69","title":"测试标题","content":"测试内容 ","time":"2017-07-25 09:01:16","hits":"37","art_love":"0"}'var b=JSON.parse(a)console.log(b){ id: '69',title: '测试标题',content: '测试内容 ',time: '2017-07-25 09:01:16',hits: '37',art_love: '0' }
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答