2019-07-31Python从json数组取具体值

import json

aa=[{
 "_id": "5436e3abbae478396759f0cf",
 "name": "ISIC_0000000",
 "updated": "2015-02-23T02:48:17.495000+00:00"
},
{
 "_id": "5436e3acbae478396759f0d1",
 "name": "ISIC_0000001",
 "updated": "2015-02-23T02:48:27.455000+00:00"
},
{

 "_id": "5436e3acbae478396759f0d3",
 "name": "ISIC_0000002",
 "updated": "2015-02-23T02:48:37.249000+00:00"
},
{
 "_id": "5436e3acbae478396759f0d5",
 "name": "ISIC_0000003",
 "updated": "2015-02-23T02:48:46.021000+00:00"
 }]

ss=json.dumps(aa,indent=4,ensure_ascii=False)
data = json.loads(ss)
for element in data:
    id = element["name"]
    print(id)

for each in data:
    print (each['_id'])
    print (each['name'])
    print (each['updated'])

运行结果
nelra.png

你可能感兴趣的:(2019-07-31Python从json数组取具体值)