【发布时间】:2021-03-20 23:53:43
【问题描述】:
我有以下 json,如果“值”与特定模式匹配,我想删除键。键的名称不是固定的或预先确定的。
{
"resources": [{
"tags": null,
"properties": {
"customerId": "1234-cbd9-42bc-9193-f6432a6ef0d4",
"provisioningState": "Succeeded",
"sku": {
"maxCapacityReservationLevel": 3000,
"lastSkuUpdate": "Fri, 19 Mar 2021 16:38:12 GMT"
},
"createdDate": "Fri, 19 Mar 2021 16:38:12 GMT",
"modifiedDate": "Fri, 19 Mar 2021 17:27:54 GMT",
"status": {
"events": [{
"count": 1,
"firstTimestamp": "2021-03-19T16:40:59Z",
"lastTimestamp": "2021-03-19T16:40:59Z",
"name": "Pulling",
"type": "Normal"
}]
}
}
}]
}
预期输出
在删除以下键作为值匹配时间戳格式后。
- lastSkuUpdate
- 创建日期
- 修改日期
- 第一个时间戳
- 最后一个时间戳
{
"resources": [{
"tags": null,
"properties": {
"customerId": "1234-cbd9-42bc-9193-f6432a6ef0d4",
"provisioningState": "Succeeded",
"sku": {
"maxCapacityReservationLevel": 3000,
},
"status": {
"events": [{
"count": 1,
"name": "Pulling",
"type": "Normal"
}]
}
}
}]
}
【问题讨论】:
-
请展示您尝试过的方法,以及不适合您的方法。
-
你心目中的时间戳格式是什么?