JSON.stringify没有逃脱? [英] JSON.stringify doesn't escape?

查看:218
本文介绍了JSON.stringify没有逃脱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用`JSON.stringify?字符串化一个对象,但引号不转义?我是否误解它是为了逃避报价?

I'm using `JSON.stringify? to stringify an object, but the quotes are not escaped? Am I misunderstanding that it's suppose to escape the quotes?

这是输出到模板中而没有任何报价被转义:

This is outputted into the template without any of the quotes being escaped:

{"console":{"free":false}}


推荐答案

属性名称周围的引号不应该被转义,只能在字符串内引用。你的JSON没问题:)

The quotes around property names are not supposed to be escaped, only quotes inside strings. Your JSON is fine :)

这篇关于JSON.stringify没有逃脱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆