用新属性替换 json 属性

问题描述 投票:0回答:1

在我的角度应用程序中,我有一个在组件中动态构建的 JSON,它就像 main.json 在某些情况下,我想用我们在replace.json中看到的内容替换这里完整的“filters”属性

main.json

 "description": "yyy",
"query": {
    "filterInfo": {
        "filters": [
            {
                "Id": 8,
                "column": "rollnumber",
                "from": "12",
                "to": "25"
            },
            {
                "Id": 89,
                "column": "dob",
                "value": "nov-14-1985"
            }
        ]
    }
}

}

replace
filters:[
{
    "Id": 89,
    "column": "dob",
    "value": "DATE"
},
{
    "Id": 8,
    "column": "rollnumber",
    "from": "MYSTRING",
    "to": "MYSTRING"
}]
json replace properties
1个回答
0
投票

您可以创建一个脚本来加载main.json,用replace.json数据替换过滤器并重写main.json吗?

© www.soinside.com 2019 - 2024. All rights reserved.