반응형
나는 이미 여기에서 많은 예를 읽었습니다. 불행히도이 오류가 계속 발생합니다.
오류 :
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 43 (char 42)
json 파일 :
{"people": [{"name": "Scott", "from": "Nebraska", "website": "stackabuse.com"}, {"name": "Larry", "from": "Michigan", "website": "google.com"}, {"name": "Tim", "from": "Alabama", "website": "apple.com"}]}
및 또 다른 별도의 json 파일 :
{"scores":[{"name":"Larry","result":["0":"24","1":"43","2":"56"]},{"name":"Tim","result":["0":"44","1":"29","2":"34"]}]}
python 코드 :
with open('data.json') as file:
data = json.load(file)
print(data)
해결 방법
JSON이 잘못되었습니다. 배열에 :
토큰이 있습니다.
"result": ["0": "24", "1": "43", "2": "56"]
# ^ ^ ^
과
"result": ["0": "44", "1": "29", "2": "34"]
# ^ ^ ^
JSON 입력을 수정하십시오. 콜론을 쉼표로 바꾸거나 "0":
, "1":
및 "2":
'indices'를 제거하거나 [...]
배열 대괄호를 {...}
JSON 개체 중괄호로 바꿉니다.
참조 페이지 https://stackoverflow.com/questions/41262180
반응형
'파이썬' 카테고리의 다른 글
파이썬 Python unsubscriptable (0) | 2020.10.25 |
---|---|
파이썬 pandas-첫 번째 발생 찾기 (0) | 2020.10.25 |
파이썬 Django 양식의 읽기 전용 필드 (0) | 2020.10.25 |
파이썬 Python 프로그램의 간단한 UI에서 실시간 그래프를 어떻게 표시합니까? (0) | 2020.10.25 |
파이썬 How to increment datetime by custom months in python without using library (0) | 2020.10.25 |
댓글