相关疑难解决方法(0)

重命名对象中的字段

如果我有以下对象:

JsonObj = {
    "frames": {
        "cinema": {
            "sourceSize": { "w": 256, "h": 200 },
            "frame": { "x": 0, "y": 0, "w": 256, "h": 192 }
        },
        "tree": {
            "sourceSize": { "w": 128, "h": 110 },
            "frame": { "x": 0, "y": 302, "w": 70, "h": 96 }
        }
    }
};
Run Code Online (Sandbox Code Playgroud)

parsedJSON使用此JavaScript代码将此JSON对象解析为变量:

var parsedJSON = JSON.parse(JsonObj);
Run Code Online (Sandbox Code Playgroud)

如何将"frames"属性重命名parsedJSON为其他内容?

javascript

3
推荐指数
1
解决办法
5225
查看次数

标签 统计

javascript ×1