I have this json:
json = [{
"code3": "ALB",
"asset": 9,
"biodiversity": 4,
"infrastructure": 15
}, {
"code3": "GHN",
"asset": 4,
"biodiversity": 5,
"infrastructure": 5,
}, {
"code3": "TGO",
"asset": 3,
"biodiversity": 6,
"infrastructure": 7
}]
I am trying to filtering it down to this in a for loop:
result = [{
"code3": "ALB",
"asset": 9
}, {
"code3": "GHN",
"asset": 4
}, {
"code3": "TGO",
"asset": 3
}]
What is the fastest way to do this. I know I could use json.forEach(j => del j["infrastructure"] ...
or something similar but I am looking to filter out by the keys code3, asset
instead