What does json.load(f) do with a json file?
Problem in JSON
Suppose, you have a file named person.json
which contains a JSON object.
{
"name": "Bob",
"languages": ["English", "Fench"]
}
Here’s how you can parse this file:
import json
with open('path_to_file/person.json') as f:
data = json.load(f)
Here, the open()
function is used to read the json file. Then, the file is parsed using json.load()
method which gives us a dictionary named data.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.