来自档案,
====================================
{
"id": "ffc131ff-1793-4109-940f-5b537f7061cf",
"securityResourceId": "48d0eeff-690d-4c2c-b6f9-9b25315f9ca3",
"name": "Dev-bpimdmgr-idev3-01",
"active": true,
"licensed": true,
"licenseType": "AUTHORIZED",
"status": "ONLINE",
"tags": []
},
{
"id": "82db2888-7a2f-48fe-bc25-26a5e28bb340",
"securityResourceId": "5a437865-6ced-402e-ac47-dd38191e5696",
"name": "obiee-cmixdmgr-nprd3-01",
"active": true,
"licensed": true,
"licenseType": "AUTHORIZED",
"status": "ONLINE",
"tags": [
{
"id": "fbf62944-a8a4-4a22-8e75-cd8d88eacaff",
"name": "obiee-tag",
"color": "#32cd32",
"description": "obiee tag for version import",
"objectType": "Agent"
}
]
},
我想删除tags []块,包括这个块里面的位置。通过perl或shell脚本
此致 Kalaiyarasan
答案 0 :(得分:5)
只需使用JSON模块:
use JSON qw{ from_json to_json };
my $struct = from_json("[$input]");
delete $_->{tags} for @$struct;
print to_json($struct);