我已经构建了一个API以从数据库获取数据,但是它在附件数据中添加了转义字符。如何删除此反斜杠?
QueryGenerator.getEventList(req.user.dbName, req.user.teacherId, req.body.limit, req.body.skip, req.body.dateStart||'', req.body.dateEnd||'')
.then(result=>{
res.ok(result);
}).catch(error=>{
console.log(error);
res.ok({message: 'Something went wrong', error: error},"ERROR","ERROR");
})
{
`"code": "OK",`
`"message": "Operation executed successfully",
`
`"data": [
{
"id": 11,
"events": "sasasa",
"edate": "20-03-2019",
"detail": "asasasa",
"class_id": "7",
"attachment": "\"\"",
"noticetype": "sasasa",
"youtubeurl": "",
"addedon": "1556197002625"
},
{
"id": 12,
"events": "C6f6g5",
"edate": "25-04-2019",
"detail": "Gctctc",
"class_id": "40",
"attachment": "[{\"attachment\":\"http://www.example.com/xyz/abc/abc/qwerty.jpg\"},{\"attachment\":\"http://www.example.com/abc/abc/abc/xyz.jpg\"}]",
"noticetype": "section",
"youtubeurl": "",
"addedon": "1556194761807"
}
]`
}