【发布时间】:2021-08-28 21:30:08
【问题描述】:
当我执行JSON.stringify({theKey : 'some\thing'} 时,结果将是:
{"theKey" : "some\\thing"}
但是 queryObject 从 mongoose 查询返回,JSON.stringify(queryObject) 不会添加第二个反斜杠,所以当我在另一端解析它时它会给我错误。谢谢
【问题讨论】:
-
结果将是 `{"theKey" : "some\\thing"},但带有 ...
-
如果你把代码部分反引号`
`它会被高亮显示 -
你看到额外的
` when inspecting in a REPL or the console? It's not actually in the JSON. The JSON value is also"some\thing"`
标签: javascript json express mongoose