我希望在python中以json格式获得agentName
之类的键的特定值。怎么办呢?
{
"metaData": {
"fields": [
"id",
"path",
"time",
"userid",
"type",
"size",
"lastProcessed",
"numProcessed"
],
"queueStatus": {
"agentId": "publish-xxxxx",
"agentName": "publish-xxxxx",
"isBlocked": false,
"isPaused": false,
"lastProcessTime": -1,
"nextRetryPeriod": -1524578525793,
"processingSince": -1,
"time": 1524578525792
},
"root": "queue"
},
"queue": []
}
答案 0 :(得分:1)
d={'metaData': {'fields': ['id',
'path',
'time',
'userid',
'type',
'size',
'lastProcessed',
'numProcessed'],
'queueStatus': {'agentId': 'publish-xxxxx',
'agentName': 'publish-xxxxx',
'isBlocked': False,
'isPaused': False,
'lastProcessTime': -1,
'nextRetryPeriod': -1524578525793L,
'processingSince': -1,
'time': 1524578525792L},
'root': 'queue'},
'queue': []}
#Code:
In [6]: d['metaData']['queueStatus']['agentName']
Out[6]: 'publish-xxxxx'