json

インポート

import json

json形式のファイルの辞書型データへの読み込み

json形式を直接読み込んで、結果は辞書型データにな。

with open(filename, mode='r', encoding='utf-8') as file1:
            json_file = json.load(file1)

読み込んだあとは辞書型データの処理を行う。

jsonから読み込んだ辞書型データの長さ

len(json_file['data'])