[{"changed_aspect": "media", "subscription_id": xxxx, "object": "user", "object_id": "xxxx", "time": "xxxxxx"}]
それは私がサーバーから取得したデータです。
jsondump = json.dump(データ)
しかし、jsondump[1]["changed_aspect"] を実行すると、メディアの値が表示されません。どこが間違っていますか?
[{"changed_aspect": "media", "subscription_id": xxxx, "object": "user", "object_id": "xxxx", "time": "xxxxxx"}]
それは私がサーバーから取得したデータです。
jsondump = json.dump(データ)
しかし、jsondump[1]["changed_aspect"] を実行すると、メディアの値が表示されません。どこが間違っていますか?
subscription_id が有効な文字列であると仮定すると、
>>> import json
>>> c = '[{"changed_aspect": "media", "subscription_id": "xxxx", "object": "user", "object_id": "xxxx", "time": "xxxxxx"}]'
>>> data = json.loads(c)
>>> data[0]['changed_aspect']
u'media'
Python のリストは 0 ベースのインデックスであるため、インデックスは 1 ではなく 0 にする必要があります。