I have the following JSON:
x = "test" : [{"a":"2",
"b":"2",
"c":"2",
"d":"2",
"e":"2",
},
{"a":"2",
"x":"2",
"c":"2",
"d":"2",
"e":"2",
},
{"a":"2",
"y":"2",
"c":"2",
"d":"2",
"e":"2",
}],
I want to be able to loop over this JSON and find all keys 'x' and 'y' and delete them. I have no issues deleting keys that exist across all JSON objects, however, when it comes to object specific keys like 'x' and 'y' I seem to be hitting an obstacle.
What I have tried so far:
for i in x['test']:
del(i['x'])
del(i['y'])
But then I get this error:
KeyError: 'extension'
All help is appreciated
Thanks