I am trying to read the http response in python. the response is as below and I need to extract all records out of the specific fields. Below is my json output, i have trimmed it. But I am getting type error. I am new to python not sure what I am missing here.
TypeError: list indices must be integers, not str
My code:
data={u'Movies': [{u'Movie': {u'movieID': u'30', u'status': u'released', u'aflag': u'1', u'Type': u'action', u'releasedate': u'1276624', u'moddate': u'1276636', u'name': u'titanic', u'frameflag': u'1', u'class': u'UA'}},{u'Movies': [{u'Movie': {u'movieID': u'32', u'status': u'released', u'aflag': u'0', u'Type': u'action', u'releasedate': u'1276624', u'moddate': u'1276636', u'name': u'movie2', u'frameflag': u'1', u'class': u'UA'}}
data_j=json.loads(data)
for i in data_j['Movies']['data_j']:
print i['Movie']['name']
datavariable is already a Python dictionary. It is not a JSON value. Did you give us thedjata_jvalue instead?