小编bru*_*eds的帖子

JSON.parse没有预期的行为

我正在尝试收到一个json请求post,并JSON.parse通过它发送.但是这个错误发生了:

未捕获的SyntaxError:位于JSON.parse()的位置2的JSON中的意外的标记m:1:19

下面的代码重现了错误:

const string = '{ msg_reject: \'Rejeitado porque sim\', accept: 1, photo: \'FSADKJK23B1\' }'
const json = JSON.parse(string)
Run Code Online (Sandbox Code Playgroud)

这就是我发送给我的方式 post

{ msg_reject: 'Rejeitado porque sim', accept: 1, photo: 'FSADKJK23B1' }

我发送它的方式有什么问题吗?

javascript json node.js ecmascript-6

5
推荐指数
2
解决办法
687
查看次数

标签 统计

ecmascript-6 ×1

javascript ×1

json ×1

node.js ×1