def remove ( parent , idx ) : if isinstance ( parent , dict ) : del parent [ idx ] elif isinstance ( parent , list ) : del parent [ int ( idx ) ] else : raise JSONPathError ( "Invalid path for operation" )
delete a json key in python
Remove a value from a dict .
def remove(parent, idx):
  """Remove a value from a dict."""
  if isinstance(parent, dict):
    del parent[idx]
  elif isinstance(parent, list):
    del parent[int(idx)]
  else:
    raise JSONPathError("Invalid path for operation")