如何在 Firefox 开发者控制台中禁用自动字符串转义?

jud*_*ira 7 javascript console firefox

来自 Chrome,我习惯于在开发人员 JS 控制台中生成非转义字符串:

\n
> JSON.stringify(JSON.parse('{"a": 10}'))\n{"a":10}\n
Run Code Online (Sandbox Code Playgroud)\n

\xe2\x80\x8b但是,在 Firefox 中,它会生成以下内容:

\n
> JSON.stringify(JSON.parse('{"a": 10}'))\n"{\\"a\\":10}"   <-- notice that the quote has been escaped as \\", which is correct, but not what I want\n
Run Code Online (Sandbox Code Playgroud)\n

\xe2\x80\x8b如何指示 Firefox 停止转义 JS 控制台中打印的字符串?

\n

小智 8

您可以像这样简单地使用 console.log() :

> console.log(JSON.stringify(JSON.parse('{"a":10}')))
{"a":10}

干杯!