I have JSON in response and I'm trying to get all "Id" and "Pages" values and put them to an array (or list) for next steps
[
{
"Page": 1,
"Content": [
{"Id": 100000000000001,"Title": "title1", ...},
{"Id": 100000000000002,"Title": "title2", ...},
{"Id": 100000000000003,"Title": "title3", ...}
]
},
{
"Page": 2,
"Content": [
{"Id": 100000000000004,"Title": "title4", ...},
{"Id": 100000000000005,"Title": "title5", ...},
{"Id": 100000000000006,"Title": "title6", ...}
]
},
{
"Page": 3,
"Content": [
{"Id": 100000000000007,"Title": "title7", ...},
{"Id": 100000000000008,"Title": "title8", ...},
{"Id": 100000000000009,"Title": "title9", ...}
]
}
]
Got "Page" values by using pages = [ e['Page'] for e in data ] from here
Can't get "Id" values. Tried
for el in data:
print (el['Content']['Id'])
But got error TypeError: list indices must be integers or slices, not str
Can you help me?
Update1: Sorry for my slightly incorrectly asked question: as output from this JSON I want to return array ["id1","id2",...,"id9"], not print