以下是我尝试在python中解析的示例JSON。 我很难解析"文件": 任何帮助表示赞赏。
{
"startDate": "2016-02-19T08:19:30.764-0700",
"endDate": "2016-02-19T08:20:19.058-07:00",
"files": [
{
"createdOn": "2017-02-19T08:20:19.391-0700",
"contentType": "text/plain",
"type": "jpeg",
"id": "Photoshop",
"fileUri": "output.log"
}
],
"status": "OK",
"linkToken": "-3418849688029673541",
"subscriberViewers": [
"null"
]
}
答案 0 :(得分:1)
打印数组中每个文件的id
:
import json
data = json.loads(rawdata)
files = data['files']
for f in files:
print(f['id'])