Python で jsonの変数を持たせたいことがあり、読み込む上でのメモ
import json
list = [{"name":"Worker","no":"123"}, {"name":"User","no":"456"}, {"name":"Organization","no":"789"}, {"name": "Position","no":"123"}, {"name": "PositionTranslation","no":"123"}]
for d in list:
print(d.get('name'))
print(d.get('no'))
print("-----")
list の中に json の配列を格納
loop の中で .get(key名)を行うことで value を取り出すことができる
結果
Worker
123
-----
User
456
-----
Organization
789
-----
Position
123
-----
PositionTranslation
123
-----