javascript - 在 JSON 键或值中使用双引号

标签 javascript json

我想在 JSON 中使用双引号 ",但它不起作用。

这是我的 JSON

"I": {
        "1: Vehicle Con"trol:M": { 
            "D2": {
                "VM": "3300.00",
                "VSD": "324.04",
                "G":"1: Ve"hicle Control:M",
                "N":"-1"
            }
     }

最佳答案

JSON specification http://json.org/

您可以在键或值中使用 \" 来转义 "

此 Json 有效 - 在 JSONLint 上测试

{
    "I": {
        "1: VehicleCon\"trol: M": {
            "D2": {
                "VM": "3300.00",
                "VSD": "324.04",
                "G": "1: Ve\"hicleControl: M",
                "N": "-1"
            }
        }
    }
}

关于javascript - 在 JSON 键或值中使用双引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21405357/

相关文章:

javascript - IE8不显示文本区域调整右下角

javascript - 使用(子堆栈的)磁带模块进行测试时,如何在文件中只运行一个测试?

javascript - 将Float64Array转换为数组

javascript - 添加空数组和对象时,为什么控制台返回这样的结果?

json - 在 Go 中将嵌套的 JSON 解码为平面结构

json - 如何在Dart中使用枚举的属性名称将JSON映射到对象

javascript - 在jsp中使用sweetalert javascript函数

javascript - 如何使用 javascript For In 或 Object.keys 循环从 json 数组排序帖子

python - JSON 格式的 "TypeError: list indices must be integers, not str"

java - 比较 Java 中的两个 JsonArray 节点