-2
這是我的JSON數據:如何在Python中迭代JSON列表?
{
"AccountRegion": "testaccount",
"AssumeRole": "arn",
"Policies": [
"hello",
"world"
],
"Region": "usa"
},
{
"AccountRegion": "testaccount-2",
"AssumeRole": "arn",
"Policies": "anotherpolicy",
"Region": "usa"
}
我無法弄清楚如何遍歷JSON。我想遍歷數據並獲取數據集中每個成員的策略。我怎樣才能做到這一點?
你嘗試過這麼遠嗎? –
看起來副本的http://stackoverflow.com/questions/20199126/reading-json-from-a-file –
我已經把json數據放在一個變量中,我已經通過這樣的json循環,沒有成功 'for數據['Items']: region = data ['Region'] assumerole = data ['AssumeRole'] policies = data ['Policies'] for table_scan ['Items'] ['policies' ]: print policy' –