here is my json file which has sample data in nested dictionaries like below
data = {
'school': {
'name': 'abc',
'class': {
'firstclass': {'teacher': 'b', 'students': '10'},
'secondclass': {'teacher': 'c', 'students': '25'},
}, 'city': 'x'},
'college': {
'name': 'def',
'class': {
'firstclass': {'teacher': 'd', 'students': '9'},
'secondclass': {'teacher': 'e', 'students': '65'},
}, 'city': 'y'},
'university': {
'name': 'ghi',
'class': {
'firstclass': {'teacher': 'f', 'students': '55'},
'secondclass': {'teacher': 'g', 'students': '22'},
}, 'city': 'z'}
}
my output should be like:
'teacher':'b','students':'10'
'teacher':'d','students':'9'
'teacher':'f','students':'55'
here is my code in for loop:
for id in data:
for j in data[id]:
print(j ,"=" , data[id][j])
i am not getting above expected output. how to get exact output as above .