I am trying to load in a json file. Update it and write it back. Here is my attempt at it but I am getting an error:
TypeError: dump() takes at least
You forgot to pass in the file object:
json.dump(employees, data_file)
Since you are using the file object as a context manager with the with
statement, you do not need to manually close the file. And using just data_file.close
is entirely redundant since you are not even calling the file.close()
method.