{'PCCandidateDetails': {'BatchId': '456279',
'Candidate': 'Noori sahi ',
'CandidateId': '9124657',
'CenterName': 'K',
'ProjectName': 'PKKVY',
'QPName': 'Domestic Data Entry Operator(SSC/Q2212)',
'TrainingProviderName': 'OrionEdutechPrivateLimited'},
'PCTestScores': [{'MaxScore': 12,
'PCId': 'SRC/N3022_PC1',
'PCName': 'obtain sufficient information from the customer /client to understand the need and perform initial task',
'Percentage': 0,
'YourScore': 0},
{'MaxScore': 15,
'PCId': 'SRC/N3022_PC10',
'PCName': 'compares transcribed data, as displayed on a visual screen, document and corrects any errors with the source',
'Percentage': 0,
'YourScore': 0},
{'MaxScore': 5,
'PCId': 'SSC/N3022_PC11',
'PCName': 'obtain help or advice from specialist if the problem is outside his/her area of competence or experience',
'Percentage': 0,
'YourScore': 0}]}
I want to loop over this json object which I have got using web request.
import requests,ast
r = requests.get("some url")
data = r.text
data_dic = ast.literal_eval(data)
When I try to loop over the Json I am not able to fetch the expected output in key- Value pair. I want output like this
BatchId : 456279
Candidate : Noori sahi
CandidateId :9124657 ...
and so on. Below code is My approach but dictionary inside the list is causing problem in looping.
for i in data_dic:
for k,v in i.iteritems():
print k,v
What I'm getting as error is 'str' object has no attribute 'iteritems'. What is the right approach for looping this kind of data.