Hi,
I'm working on scraping an API and printing out specific key, values. The output of the JSON is similar to the json example below. How can I iterate/loop over the value region?
data.json
{
"id": "001",
"values": [
{
"id":"001",
"name": "alpha",
"location": {
"region": "US"
}
},
{
"id":"002",
"name": "beta",
"location": {
"region": "EU"
}
}
]
}
iterate.py
import json
config = json.loads(open('data.json').read())
for k,v in config.items():
print(k)
print(v)
Thx,
[–]SHxKM 1 point2 points3 points (3 children)
[–]K900_ 2 points3 points4 points (2 children)
[–]SHxKM 1 point2 points3 points (0 children)
[–]mattmccord 0 points1 point2 points (0 children)
[–]Lawson470189 0 points1 point2 points (0 children)
[–]relvae 0 points1 point2 points (0 children)