I am iterating a JSON and I want to extract the following fields from this object:
- Id,
- Open_date
- User
- Ticket_status
- End_date
The data structure that I have is like the following :
filtered_data =
[{'id': 1021972, 'Aging_Deferred_Transferred': '', 'Aging_Open_Issue': '0.94',
'Aging_Un_investigated_Issue': '0.94', 'User': 'John P.', 'ModifiedOn': '2017-09-04 21:29:59',
'Open_date':'2017-08-04 01:34:18','End_date':'2017-09-05 00:29:01',
'Ticket_status':'Transferred'},{'id': 1036722, 'Aging_Deferred_Transferred': '', 'Aging_Open_Issue': '0.12',
'Aging_Un_investigated_Issue': '0.01', 'User': 'John P.', 'ModifiedOn': '2017-09-04 21:29:59',
'Open_date':'2017-09-01 00:34:18','End_date':'',
'Ticket_status':'Researching'},{'id': 1015621, 'Aging_Deferred_Transferred': '', 'Aging_Open_Issue': '0.99',
'Aging_Un_investigated_Issue': '0.11', 'User': 'John D.', 'ModifiedOn': '2017-06-05 12:19:59',
'Open_date':'2017-01-01 00:00:18','End_date':'2017-09-01 20:20:57',
'Ticket_status':'Closed'}]
I want to return a data structure such as a Dictionary (if you think there is a better a data structure for achieving my goal please mention it) as the following:
dict_user_john_p = {'ID':1021972,'Open_date':'2017-08-04 01:34:18','Ticket_status':'Transferred','End_date':'2017-09-05 00:29:01',
'ID':1036722,'Open_date':'2017-09-01 00:34:18','Ticket_status':'Researching','End_date':''}
dict_user_john_D = {'ID':1015621,...,'End_date':'1015621'}
How can I extract the mentioned specific fields and return them as another data structure (dictionary)?