2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

JSONファイルの日本語を表示する

Last updated at Posted at 2020-05-25

問題

Pythonのrequestsで日本語が含まれているJSON形式のデータを取得時の文字化け問題

解決策

下記の行を追加したら日本語が正しく表示されました〜

r.headers = {"Content-Type": "application/json; charset=utf-8"}

こんな感じ↓

r = requests.get(url)
r.headers = {"Content-Type": "application/json; charset=utf-8"}
datas = r.json()
print(datas)
2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?