在JSON文件的部分中有一些我不想要的值;我如何批量删除它们?
注意:我想用node.js删除
JSON示例:
"attributes": [
{
"trait_type": "Background",
"value": "CHOCOLATE"
},
{
"trait_type": "eyes",
"value": "g"
},
{
"trait_type": "body",
"value": "a1"
},我希望删除body和eyes值。
发布于 2021-11-11 10:57:45
这应该可以完成以下工作:
const valuesToDelete = ['eyes', 'body'];
let attributes = [] //your attributes data
attributes = attributes.filter(({ trait_type }) => !valuesToDelete.includes(trait_type));https://stackoverflow.com/questions/69926479
复制相似问题