I am currently trying to extract product data from a JSON feed that contains nested data.
The nested structure is looking as follows: http://live.icecat.biz/api/?shopname=openIcecat-live&lang=en&content=featuregroups&icecat_id=1334921
I basically want to extract basic datasheet information for products in the database. Each product has different feature categories at the "top-level" and varying features below that in a nested structure.
My code looks like this so far:
import requests
url2 = 'http://live.icecat.biz/api/?shopname=openIcecat-live&lang=de&content=featuregroups&icecat_id=1334921'
content = requests.get(url).content
j = json.loads(content)
for each in j['data']['FeaturesGroups']:
print each ['FeatureGroup']['Name']['Value']
It works fine and prints the headlines of each feature category. But I am unable to parse the individual features. How can I do this ?
My attempt was to use a second loop to iterate over j['data']['FeaturesGroups']['Features'] (see below) but no success :/
for each in j['data']['FeaturesGroups']:
for each in ['Features']:
print ['Feature']['ID']
Thanks a lot!
for each in ['Features']->for each2 in each['Features']/print ['Feature']['ID']->print(each2['ID']).