I have a json dictionary (result_dict_tag
) as follows:
{'10644906845': {'photo': {'id': '10644906845',
'tags': {'tag': [{'_content': 'srilanka',
'author': '34665545@N05',
'authorname': 'CrishyM',
'id': '34660205-10644906845-23098',
'machine_tag': 0,
'raw': 'sri lanka'},
{'_content': 'navy',
'author': '34665545@N05',
'authorname': 'CrishyM',
'id': '34660205-10644906845-7137',
'machine_tag': 0,
'raw': 'navy'},
{'_content': 'vessel',
'author': '34665545@N05',
'authorname': 'CrishyM',
'id': '34660205-10644906845-8792',
'machine_tag': 0,
'raw': 'vessel'}]}},
'stat': 'ok'},
'11778819726': {'photo': {'id': '11778819726',
'tags': {'tag': [{'_content': 'sri',
'author': '44455081@N07',
'authorname': 'Vinchel',
'id': '44433751-11778819726-12165',
'machine_tag': 0,
'raw': 'sri'},
{'_content': 'lanka',
'author': '44455081@N07',
'authorname': 'Vinchel',
'id': '44433751-11778819726-12166',
'machine_tag': 0,
'raw': 'lanka'},
{'_content': 'mirissa',
'author': '44455081@N07',
'authorname': 'Vinchel',
'id': '44433751-11778819726-1158107',
'machine_tag': 0,
'raw': 'mirissa'}]}},
'stat': 'ok'}}
What I want is to extract the 'raw' words from each dictionary (e.g.result_dict_tag['10644906845']['photo']["tags"]['tag'][0]['raw']
) and and create a dataframe consisting user id and relevant raw words for each user. I feel this need some for loop. I have written one and it only results the 'raw' words related to first user only. I have gone through documentation and various questions similar to this. But couldn't figure it out. Any help is appreciated.