发送 axios post 请求时向 json 文件添加反斜杠。即使我使用替换,反斜杠也不会被删除
axios
.post(
"https://test-manager/backend",
{
gameName: this.gameName,
platform: this.gamePlatform,
json: finalData.replace(/\\/g, ""),
}
)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
最佳答案
您需要使用 JSON.parse
解析字符串化的 json,如下所示:
json: JSON.parse(finalData),
关于javascript - 如何从 axios post 请求中的 json 中删除反斜杠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69966117/