0

I have same problem like there. My error call is builtins.AttributeError: module 'json' has no attribute 'load' but I imported json as first so what is wrong?

import json

f = open('data.json')

data = json.load(f) 

for i in data['emp_details']:
    print(i)
 
f.close()
  • @PedroMaia That's clearly the wrong answer, since he's loading from a file not a string. – Tim Roberts Oct 29 '21 at 20:08
  • 1
    You almost certainly have your own file called `json.py` in your project. You are importing that one, not the standard library `json`. You need to rename that file. – Tim Roberts Oct 29 '21 at 20:08

1 Answers1

0

you have a json module(folder) in your project folder (root path of your project ), rename it

or you have a file that name is json.py , rename it

(root of project)
  |
  | main.py
  |
  | json.py
  |
  |------ json 
  |       |- __init__.py
  |       |- other file.py


PersianMan
  • 924
  • 1
  • 12
  • 29