Reputation: 21
Here is the sample JSON which I am trying to parse in python. I am having hard time parsing through "files": Any help appreciated.
{
"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"
]
}
Upvotes: 1
Views: 1599
Reputation: 18531
To print the id
of each file in the array:
import json
data = json.loads(rawdata)
files = data['files']
for f in files:
print(f['id'])
Upvotes: 1