'Accessing unique json array
I'm aware the code won't work because I can't work out how to access each array, i.e. Person-Ryan and Personal-Luke.
There will be multiple and each will be unique and won't know what they be called beforehand.
I would like to print the name on each one in a loop.
JSON:
"entities": {
"Person-Ryan": {
"name":"Ryan"
},
"Person-Luke": {
"name": "Luke"
}
}
Code:
response = requests.request("GET", url, headers=headers, data=payload)
res_json = response.json()
for inner_dict in res_json:
Test = inner_dict['name']
print (Test)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
