數據搜索了很多,我認爲在我剛纔的答案的一半我的問題 當我有一個JSON響應就是這個樣子Python的JSON得到響應
{
"queryResponse": {
"@last": 3,
"@first": 0,
"@count": 4,
"@type": "ClientDetails",
"@requestUrl": "https://1.1.1.1/webacs/api/v2/data/ClientDetails?userName=contains("usertest")",
"@responseType": "listEntityIds",
"@rootUrl": "https://1.1.1.1/webacs/api/v2/data",
"entityId": [
{
"@type": "ClientDetails",
"@url": "https://1.1.1.1/webacs/api/v2/data/ClientDetails/236551459",
"$": "236551459"
},
{
"@type": "ClientDetails",
"@url": "https://1.1.1.1/webacs/api/v2/data/ClientDetails/267361256",
"$": "267361256"
},
{
"@type": "ClientDetails",
"@url": "https://10.141.1.29/webacs/api/v2/data/ClientDetails/370079361",
"$": "370079361"
},
{
"@type": "ClientDetails",
"@url": "https://1.1.1.1/webacs/api/v2/data/ClientDetails/501402176",
"$": "501402176"
}
]
}
}
因爲我想獲得一個列表@url但我剛纔已經能夠得到ENTITYID
json_obj = response.json()
object = json_obj['queryResponse']
entityId = object['entityId']
print(entityId)
,我不能從ENTITYID打印,但我不能得到公正的每場場@url。任何幫助將非常感激。
基本上你需要循環到entityId並獲取特定對象來讀取和訪問它的索引。 –