aztro

부분 유료
Verified
분류별 Sameer Kumar | 업데이트됨 a month ago | Science
인기

0.5 / 10

지연 시간

628ms

서비스 수준

44%

Health Check

N/A

모든 토론으로 돌아가기

json typeerror

Rapid account: Quarks 1
Quarks1
2 years ago

I’m currently having an issue where randomly I’ll get the error “TypeError: the JSOn osbjext must be str, bytes, or bytearray, not dict” when trying to do json.loads. It’s weird because it works sometimes, but then other times causes this error without changing the code at all. Do you know why this happens?

Rapid account: Sameer Kumar
sameer.kumar Commented a year ago

Likely issue is in
**new_response = json.loads(response.json())**
replace it with new_response = response.json()

Rapid account: Quarks 1
Quarks1 Commented 2 years ago

I am trying to extract the “description” part of the response
to do this i am doing
new_response = json.loads(response.json())
description = new_response[“description”]

This is all in python, am I doing something wrong?

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입