Im trying to delete a single index in a list which is inside a json file
the file
{
   "0": [
      "0",
      "1",
      "2",
      "3"
   ]
}
The program
import json
with open("main.json","r") as jsonfile:
  jsonfile = json.load(jsonfile)
key = "0"
index = int(input("which index u want to remove: "))
with open("main.json","r+") as f:
  if key in jsonfile:
    #jsonfile[key].append(str(index))
    del jsonfile[key][index]
    
    json.dump(jsonfile,f,indent=3)
This is how it looks after the programme deletes the index:

Please say how to stop this problem. Im using repl.it
 
     
     
    