Back
For reading a JSON file in Python, you can refer to the below code:
# json file import json # Opening JSON file f = open('data.json',) # returns JSON object as a dictionary data = json.load(f) # Iterating through the json list for i in data['emp_details']: print(i) f.close() # Closing file
# json file
import json # Opening JSON file
f = open('data.json',) # returns JSON object as a dictionary
data = json.load(f) # Iterating through the json list
for i in data['emp_details']:
print(i)
f.close() # Closing file
If you are looking for an online course to learn Python, I recommend this Python Online Course program by Intellipaat.
30.9k questions
32.9k answers
500 comments
665 users