import json
with open('test.json', 'r') as f:
data = json.load(f)
for items in data:
items["1"] += [1, 2]
with open('test.json', 'w') as f:
json.dump(data, f, indent=3)
[
{
"1": []
},
{
"2": []
}
]
items["1"] += [1, 2]
KeyError: '1'