I have like 100 json file in a folder and each json file contains information like student_id, student_nationality etc. How do I use readlines for each json file using os method?
path_to_json = 'directory'
json_files = [pos_json for pos_json in os.listdir(path_to_json) if pos_json.endswith('.json')]
When I try to loop in each file, I can't use file.readlines() as it says "Str don't have attributes readlines()”. I guess we can only use readlines if its a list type.
I need to be able to read each json file and get the information I need.