Loading Data from a JSON File
We'll cover the following...
We'll cover the following...
Like the pickle module, the json module has a load() function which takes a stream object, reads JSON-encoded data from it, and creates a new Python object that mirrors the JSON data structure.
① For demonstration purposes, switch to Python Shell #2 and delete the entry data structure that you created earlier in this chapter with the pickle module.
② In the simplest case, the json.load() function works the same as the pickle.load() function. You pass in a stream object and it returns a new Python object.
③ I have good news and bad news. Good news first: the json.load() function successfully read the entry.json file you created in Python Shell #1 and created a ...